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 '#'.
diff --git a/Python/getargs.c b/Python/getargs.c
index f166921..7931b33 100644
--- a/Python/getargs.c
+++ b/Python/getargs.c
@@ -256,6 +256,13 @@
return 0;
}
}
+
+ if (*format != '\0' && !isalpha(*format) &&
+ *format != '|' && *format != ':' && *format != ';') {
+ PyErr_Format(PyExc_SystemError,
+ "bad format string: %s", formatsave);
+ return 0;
+ }
return 1;
}