This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Win64: possible integer overflow in iterobject.c
Type: Stage:
Components: Versions: Python 3.3, Python 3.4
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: python-dev, ronaldoussoren, vstinner
Priority: normal Keywords: patch

Created on 2013-05-07 22:38 by vstinner, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
iter_ssize_t.patch vstinner, 2013-05-07 22:38
Messages (5)
msg188691 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2013-05-07 22:38
seqiterobject.it_index type is long, whereas iter_setstate() uses a Py_ssize_t. It would be safer to use Py_ssize_t type for seqiterobject.it_index.

The issue emits a compiler warning on Windows 64-bit.

iterator.__getstate__() was introduced in Python 3.3, so older versions are not affected.
msg188692 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2013-05-07 22:39
I don't know how to create an "iterator" object. How can I do that?
msg188713 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2013-05-08 11:05
Create a class with a __getitem__ method but no __iter__:

class Seq (object):
    def __len__(self):
        return 5

    def __getitem__(self, idx):
        if idx > len(self):
            raise IndexError(idx)
        return idx * 2


i = iter(Seq())
msg190613 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-06-04 21:03
New changeset 757a121a27c2 by Victor Stinner in branch 'default':
Close #17932: Fix an integer overflow issue on Windows 64-bit in iterators:
http://hg.python.org/cpython/rev/757a121a27c2
msg190620 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-06-04 22:14
New changeset 52075f60719e by Victor Stinner in branch 'default':
Issuse #17932: Fix an integer overflow issue on Windows 64-bit in tuple
http://hg.python.org/cpython/rev/52075f60719e
History
Date User Action Args
2022-04-11 14:57:45adminsetgithub: 62132
2013-06-04 22:14:04python-devsetmessages: + msg190620
2013-06-04 21:04:36vstinnersetstage: resolved ->
2013-06-04 21:03:13python-devsetstatus: open -> closed

nosy: + python-dev
messages: + msg190613

resolution: fixed
stage: resolved
2013-05-08 11:05:43ronaldoussorensetnosy: + ronaldoussoren
messages: + msg188713
2013-05-07 22:39:11vstinnersetmessages: + msg188692
2013-05-07 22:38:35vstinnercreate