diff options
author | Pablo Galindo <Pablogsal@gmail.com> | 2019-02-10 19:56:58 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-02-10 19:56:58 (GMT) |
commit | 4207907c2b8c0b3da62de2acdb8b22b5bbe7f7a2 (patch) | |
tree | ef4afcf1790d3e2e9e6d4573c87c0d46cf5f51b7 /Modules | |
parent | 181835d5a9bffee247bc2f7eefc778c1812bc982 (diff) | |
download | cpython-4207907c2b8c0b3da62de2acdb8b22b5bbe7f7a2.zip cpython-4207907c2b8c0b3da62de2acdb8b22b5bbe7f7a2.tar.gz cpython-4207907c2b8c0b3da62de2acdb8b22b5bbe7f7a2.tar.bz2 |
Fix division by 0 when checking for overflow in math.prod (GH-11808)
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/mathmodule.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Modules/mathmodule.c b/Modules/mathmodule.c index d2f8d53..2272f62 100644 --- a/Modules/mathmodule.c +++ b/Modules/mathmodule.c @@ -2561,8 +2561,8 @@ math_prod_impl(PyObject *module, PyObject *iterable, PyObject *start) long x = i_result * b; /* Continue if there is no overflow */ if (overflow == 0 - && x < INT_MAX && x > INT_MIN - && !(b != 0 && x / i_result != b)) { + && x < LONG_MAX && x > LONG_MIN + && !(b != 0 && x / b != i_result)) { i_result = x; Py_DECREF(item); continue; |