Patches item #1704621, was opened at 2007-04-20 15:17 Message generated for change (Comment added) made by nnorwitz 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. ---------------------------------------------------------------------- >Comment By: Neal Norwitz (nnorwitz) Date: 2007-04-20 20:04 Message: Logged In: YES user_id=33168 Originator: NO Thanks for the patch! Can you add a test case for both conditions? ---------------------------------------------------------------------- Comment By: Jason Orendorff (jorend) Date: 2007-04-20 15:41 Message: Logged In: YES user_id=18139 Originator: NO Yes, I see it. Patch looks good. I haven't tested it. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1704621&group_id=5470 _______________________________________________ Patches mailing list Patches@python.org http://mail.python.org/mailman/listinfo/patches