commit | 76310fcc475ce58b3c8495a963519237722e2860 | [log] [tgz] |
---|---|---|
author | Guido van Rossum <guido@python.org> | Sat Jul 25 04:14:37 1998 +0000 |
committer | Guido van Rossum <guido@python.org> | Sat Jul 25 04:14:37 1998 +0000 |
tree | dfc0e29f622d8cd31bccbb189eac7bc1bb1e19d9 | |
parent | f7685d79e26417e6f7fe0ed337548f58a61950b8 [diff] [blame] |
Make sure that at least one digit has been consumed in atoi().
diff --git a/Modules/stropmodule.c b/Modules/stropmodule.c index 2d11851..73a35c9 100644 --- a/Modules/stropmodule.c +++ b/Modules/stropmodule.c
@@ -705,6 +705,10 @@ 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') {