Add explicit check for correct next character in format at end of

format.  This will complain about illegal formats like "O#" instead of
ignoring the '#'.
This commit is contained in:
Guido van Rossum 1997-12-09 20:36:39 +00:00
parent eefcba61f4
commit 231a41e708
1 changed files with 7 additions and 0 deletions

View File

@ -256,6 +256,13 @@ vgetargs1(args, format, p_va, compat)
return 0;
}
}
if (*format != '\0' && !isalpha(*format) &&
*format != '|' && *format != ':' && *format != ';') {
PyErr_Format(PyExc_SystemError,
"bad format string: %s", formatsave);
return 0;
}
return 1;
}