mirror of
https://github.com/python/cpython.git
synced 2025-07-24 19:54:21 +00:00
Merged revisions 76298 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r76298 | mark.dickinson | 2009-11-15 12:56:08 +0000 (Sun, 15 Nov 2009) | 1 line Fix another case of potential signed overflow. ........
This commit is contained in:
parent
b6447512ab
commit
d340f6cd3f
1 changed files with 4 additions and 1 deletions
|
@ -354,7 +354,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