https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111102
--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-13 branch has been updated by Jonathan Wakely <r...@gcc.gnu.org>: https://gcc.gnu.org/g:183eea6029be2f6c9f416d6ffe751c469237ff2d commit r13-7916-g183eea6029be2f6c9f416d6ffe751c469237ff2d Author: Paul Dreik <gccpatc...@pauldreik.se> Date: Thu Aug 24 11:43:43 2023 +0100 libstdc++: fix illegal pointer arithmetic in format [PR111102] When parsing a format string, the width is parsed into an unsigned short but the result is not checked in the case the format string is not a char string (such as a wide string). In case the parse fails, a null pointer is returned which is used for pointer arithmetic which is undefined behaviour. Signed-off-by: Paul Dreik <gccpatc...@pauldreik.se> libstdc++-v3/ChangeLog: PR libstdc++/111102 * include/std/format (__format::__parse_integer): Check for non-null pointer. (cherry picked from commit dd4bdb9eea436bf06f175d8dbfc2190377455be4)