diff options
author | Zackery Spytz <zspytz@gmail.com> | 2019-05-17 07:13:03 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2019-05-17 07:13:03 (GMT) |
commit | 14514d9084a40f599c57da853a305aa264562a43 (patch) | |
tree | 36cb61b74dbfda9ce1cdf72a864b640d0bda546d /Lib/test/test_array.py | |
parent | 870b035bc6da96689b59dd6f79782ec6f1873617 (diff) | |
download | cpython-14514d9084a40f599c57da853a305aa264562a43.zip cpython-14514d9084a40f599c57da853a305aa264562a43.tar.gz cpython-14514d9084a40f599c57da853a305aa264562a43.tar.bz2 |
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>
Diffstat (limited to 'Lib/test/test_array.py')
-rw-r--r-- | Lib/test/test_array.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/test/test_array.py b/Lib/test/test_array.py index 57c396d..c243957 100644 --- a/Lib/test/test_array.py +++ b/Lib/test/test_array.py @@ -746,7 +746,7 @@ class BaseTest: # Test extended slicing by comparing with list slicing # (Assumes list conversion works correctly, too) a = array.array(self.typecode, self.example) - indices = (0, None, 1, 3, 19, 100, -1, -2, -31, -100) + indices = (0, None, 1, 3, 19, 100, sys.maxsize, -1, -2, -31, -100) for start in indices: for stop in indices: # Everything except the initial 0 (invalid step) @@ -844,7 +844,7 @@ class BaseTest: self.assertRaises(TypeError, a.__setitem__, slice(0, 1), b) def test_extended_set_del_slice(self): - indices = (0, None, 1, 3, 19, 100, -1, -2, -31, -100) + indices = (0, None, 1, 3, 19, 100, sys.maxsize, -1, -2, -31, -100) for start in indices: for stop in indices: # Everything except the initial 0 (invalid step) |