mirror of
https://github.com/python/cpython.git
synced 2025-07-28 21:55:21 +00:00
Security patches from Apple: prevent int overflow when allocating memory
This commit is contained in:
parent
e70f8e1205
commit
e7d8be80ba
13 changed files with 258 additions and 29 deletions
|
@ -306,11 +306,13 @@ class CommonTest(unittest.TestCase):
|
|||
self.assertEqual(id(s), id(s*1))
|
||||
|
||||
def test_bigrepeat(self):
|
||||
x = self.type2test([0])
|
||||
x *= 2**16
|
||||
self.assertRaises(MemoryError, x.__mul__, 2**16)
|
||||
if hasattr(x, '__imul__'):
|
||||
self.assertRaises(MemoryError, x.__imul__, 2**16)
|
||||
import sys
|
||||
if sys.maxint <= 2147483647:
|
||||
x = self.type2test([0])
|
||||
x *= 2**16
|
||||
self.assertRaises(MemoryError, x.__mul__, 2**16)
|
||||
if hasattr(x, '__imul__'):
|
||||
self.assertRaises(MemoryError, x.__imul__, 2**16)
|
||||
|
||||
def test_subscript(self):
|
||||
a = self.type2test([10, 11])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue