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

This commit is contained in:
Guido van Rossum 1998-07-25 04:14:37 +00:00
parent f7685d79e2
commit 76310fcc47
1 changed files with 4 additions and 0 deletions

View File

@ -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') {