diff options
| author | Serhiy Storchaka <storchaka@gmail.com> | 2015-09-06 21:25:30 +0300 |
|---|---|---|
| committer | Serhiy Storchaka <storchaka@gmail.com> | 2015-09-06 21:25:30 +0300 |
| commit | 56f6e76c680f47ad2b11bed9406305a000a1889a (patch) | |
| tree | 072b1cbb10bcc6a2f1ddf761c5bf49a8b447a560 /Modules/posixmodule.c | |
| parent | 7827a5b7c29ae71daf0175ce3398115374ceb50e (diff) | |
| download | cpython-git-56f6e76c680f47ad2b11bed9406305a000a1889a.tar.gz | |
Issue #15989: Fixed some scarcely probable integer overflows.
It is very unlikely that they can occur in real code for now.
Diffstat (limited to 'Modules/posixmodule.c')
| -rw-r--r-- | Modules/posixmodule.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index d2b8dfd14a..270de0fd90 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -9481,7 +9481,7 @@ os__getdiskusage_impl(PyModuleDef *module, Py_UNICODE *path) */ struct constdef { char *name; - long value; + int value; }; static int @@ -9489,7 +9489,10 @@ conv_confname(PyObject *arg, int *valuep, struct constdef *table, size_t tablesize) { if (PyLong_Check(arg)) { - *valuep = PyLong_AS_LONG(arg); + int value = _PyLong_AsInt(arg); + if (value == -1 && PyErr_Occurred()) + return 0; + *valuep = value; return 1; } else { |
