mirror of
https://github.com/python/cpython
synced 2026-09-29 12:10:30 +03:00
Fix division by 0 when checking for overflow in math.prod (GH-11808)
This commit is contained in:
parent
181835d5a9
commit
4207907c2b
2 changed files with 6 additions and 2 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue