https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110862

            Bug ID: 110862
           Summary: format out of bands read on format string "{0:{0}"
           Product: gcc
           Version: 13.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gcc at pauldreik dot se
  Target Milestone: ---

The following program with an incorrect format string causes an out of bounds
read when compiled with gcc 13.2:

#include <cstdio>
#include <format>

int main() {
    unsigned short v = 0;
    std::puts(std::vformat("{0:{0}", std::make_format_args(v)).c_str());
}

I expected an exception to be thrown.

Link to reproducer: 
https://godbolt.org/z/WrqxGE1jG

Reply via email to