mirror of
https://github.com/python/cpython.git
synced 2025-10-10 00:43:41 +00:00
Fix another case of potential signed overflow.
This commit is contained in:
parent
f4817e5929
commit
b43dbc26f9
1 changed files with 4 additions and 1 deletions
|
@ -411,7 +411,10 @@ static PyObject *
|
||||||
rangeiter_next(rangeiterobject *r)
|
rangeiter_next(rangeiterobject *r)
|
||||||
{
|
{
|
||||||
if (r->index < r->len)
|
if (r->index < r->len)
|
||||||
return PyLong_FromLong(r->start + (r->index++) * r->step);
|
/* cast to unsigned to avoid possible signed overflow
|
||||||
|
in intermediate calculations. */
|
||||||
|
return PyLong_FromLong((long)(r->start +
|
||||||
|
(unsigned long)(r->index++) * r->step));
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue