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:
Mark Dickinson 2009-11-15 12:56:59 +00:00
parent b6447512ab
commit d340f6cd3f
1 changed files with 4 additions and 1 deletions

View File

@ -354,7 +354,10 @@ static PyObject *
rangeiter_next(rangeiterobject *r)
{
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;
}