Commit 76310fcc authored by Guido van Rossum's avatar Guido van Rossum

Make sure that at least one digit has been consumed in atoi().

parent f7685d79
......@@ -705,6 +705,10 @@ strop_atoi(self, args)
x = (long) PyOS_strtoul(s, &end, base);
else
x = PyOS_strtol(s, &end, base);
if (end == s || !isxdigit(end[-1])) {
PyErr_SetString(PyExc_ValueError, "no digits in int constant");
return NULL;
}
while (*end && isspace(Py_CHARMASK(*end)))
end++;
if (*end != '\0') {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment