mirror of
https://github.com/python/cpython.git
synced 2025-10-09 16:34:44 +00:00
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>
This commit is contained in:
parent
870b035bc6
commit
14514d9084
15 changed files with 45 additions and 19 deletions
|
@ -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])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue