Commit d340f6cd authored by Mark Dickinson's avatar Mark Dickinson

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.
........
parent b6447512
...@@ -354,7 +354,10 @@ static PyObject * ...@@ -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;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment