summaryrefslogtreecommitdiffstats
path: root/Lib/test/seq_tests.py
diff options
context:
space:
mode:
authorZackery Spytz <zspytz@gmail.com>2019-05-17 07:13:03 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2019-05-17 07:13:03 (GMT)
commit14514d9084a40f599c57da853a305aa264562a43 (patch)
tree36cb61b74dbfda9ce1cdf72a864b640d0bda546d /Lib/test/seq_tests.py
parent870b035bc6da96689b59dd6f79782ec6f1873617 (diff)
downloadcpython-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/seq_tests.py')
-rw-r--r--Lib/test/seq_tests.py1
1 files changed, 1 insertions, 0 deletions
diff --git a/Lib/test/seq_tests.py b/Lib/test/seq_tests.py
index 6aedd2b..65b110e 100644
--- a/Lib/test/seq_tests.py
+++ b/Lib/test/seq_tests.py
@@ -209,6 +209,7 @@ class CommonTest(unittest.TestCase):
a = self.type2test([0,1,2,3,4])
self.assertEqual(a[ -pow(2,128): 3 ], self.type2test([0,1,2]))
self.assertEqual(a[ 3: pow(2,145) ], self.type2test([3,4]))
+ self.assertEqual(a[3::sys.maxsize], self.type2test([3]))
def test_contains(self):
u = self.type2test([0, 1, 2])