[Patches] [ python-Patches-1704621 ] interpreter crash when multiplying large lists
SourceForge.net
noreply at sourceforge.net
Sat Apr 21 00:17:46 CEST 2007
Patches item #1704621, was opened at 2007-04-20 17:17
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1704621&group_id=5470
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Core (C code)
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Daniel Stutzbach (agthorr)
Assigned to: Nobody/Anonymous (nobody)
Summary: interpreter crash when multiplying large lists
Initial Comment:
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.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1704621&group_id=5470
More information about the Patches
mailing list