]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
bpo-36946: Fix possible signed integer overflow when handling slices. (GH-13375)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Fri, 17 May 2019 07:33:10 +0000 (00:33 -0700)
committerGitHub <noreply@github.com>
Fri, 17 May 2019 07:33:10 +0000 (00:33 -0700)
commitf02d1a43c6be658cd279edb90e8e96c99e1127e7
treec27f46c3ad004c5a96eeb1b498076dabd7788350
parentaa73841a8fdded4a462d045d1eb03899cbeecd65
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>
(cherry picked from commit 14514d9084a40f599c57da853a305aa264562a43)

Co-authored-by: Zackery Spytz <zspytz@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