Make sure that at least one digit has been consumed in atoi().
This commit is contained in:
parent
f7685d79e2
commit
76310fcc47
|
@ -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') {
|
||||
|
|
Loading…
Reference in New Issue