[Python-bugs-list] [ python-Bugs-526039 ] devious code can crash structseqs

noreply@sourceforge.net noreply@sourceforge.net
Wed, 06 Mar 2002 09:18:42 -0800


Bugs item #526039, was opened at 2002-03-05 18:06
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=526039&group_id=5470

Category: Python Interpreter Core
Group: Python 2.2.1 candidate
>Status: Closed
>Resolution: Fixed
Priority: 7
Submitted By: Michael Hudson (mwh)
Assigned to: Michael Hudson (mwh)
Summary: devious code can crash structseqs

Initial Comment:
Some days you feel that whenever you look closely at
something, you find bugs in it.

>>> import time
>>> class C:
...  def __getitem__(self, i):
...   raise IndexError
...  def __len__(self):
...   return 9
...
>>> time.struct_time(C())
Segmentation fault (core dumped)

This isn't hard to fix (use the PySequence_Fast API),
but I have all sorts of changes in my copy of
Objects/structseq.c and I don't want to forget this.

----------------------------------------------------------------------

>Comment By: Michael Hudson (mwh)
Date: 2002-03-06 17:18

Message:
Logged In: YES 
user_id=6656

Fixed in revision 1.5 of Objects/structseq.c.
Test in revision 1.3 of Lib/test/test_structseq.py.

----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=526039&group_id=5470