]> granicus.if.org Git - python/commit
bpo-36946: Fix possible signed integer overflow when handling slices. (GH-13375)
authorZackery Spytz <zspytz@gmail.com>
Fri, 17 May 2019 07:13:03 +0000 (01:13 -0600)
committerSerhiy Storchaka <storchaka@gmail.com>
Fri, 17 May 2019 07:13:03 +0000 (10:13 +0300)
commit14514d9084a40f599c57da853a305aa264562a43
tree36cb61b74dbfda9ce1cdf72a864b640d0bda546d
parent870b035bc6da96689b59dd6f79782ec6f1873617
bpo-36946: Fix possible signed integer overflow when handling slices. (GH-13375)

The final addition (cur += step) may overflow, so use size_t for "cur".
"cur" is always positive (even for negative steps), so it is safe to use
size_t here.

Co-Authored-By: Martin Panter <vadmium+py@gmail.com>
15 files changed:
Lib/ctypes/test/test_arrays.py
Lib/test/seq_tests.py
Lib/test/string_tests.py
Lib/test/test_array.py
Lib/test/test_bytes.py
Lib/test/test_mmap.py
Misc/NEWS.d/next/Core and Builtins/2019-05-16-23-53-45.bpo-36946.qjxr0Y.rst [new file with mode: 0644]
Modules/_ctypes/_ctypes.c
Modules/_elementtree.c
Modules/arraymodule.c
Modules/mmapmodule.c
Objects/bytearrayobject.c
Objects/bytesobject.c
Objects/tupleobject.c
Objects/unicodeobject.c