Message52496
Here's a succinct summary of the problem:
>>> x = [0] * 2**20
>>> x *= 2**20
Segmentation fault (core dumped)
>>> x = [0] * 2**20
>>> x * 2**20
[]
>>>
The problem is that list_repeat()'s check for an overflow is flawed, and list_inplace_repeat() doesn't check at all. Attached is a patch that adds a correct check to both functions. With the patch, both variations throw a MemoryError exception. The patch is against Python 2.5, but should also fix 2.5.1/2.6/3.0. |
|
Date |
User |
Action |
Args |
2007-08-23 15:58:11 | admin | link | issue1704621 messages |
2007-08-23 15:58:11 | admin | create | |
|