[Python-bugs-list] [ python-Bugs-441664 ] Python crash on del of a slice of a mmap
noreply@sourceforge.net
noreply@sourceforge.net
Mon, 16 Jul 2001 08:49:25 -0700
Bugs item #441664, was opened at 2001-07-16 04:39
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=441664&group_id=5470
>Category: Extension Modules
Group: None
>Status: Closed
>Resolution: Fixed
Priority: 5
Submitted By: Alex Martelli (aleax)
>Assigned to: Thomas Wouters (twouters)
Summary: Python crash on del of a slice of a mmap
Initial Comment:
Python 2.1.1c1 (#19, Jul 13 2001, 00:25:06) [MSC 32
bit (Intel)] on win32
Type "copyright", "credits" or "license" for more
information.
>>> flob=open('foo.txt','r+')
>>> import mmap
>>> mm=mmap.mmap(flob.fileno(),0)
>>> mm[:]
'uno\r\ndue\r\ntre\r\ne quattro\r\n'
>>> del mm[:10]
This crashes the Python interpreter. Reproduced on
both Windows/98 and NT4 SP6a.
I think it's a very simple bug at line 666 (sic!) of
mmapmodule.c: it calls PyString_Check(v), without
previously checking v!=0, and that macro defererences
v (line 52 of stringobject.h); but slice deletion
calls slice-assignment exactly with v set to 0. So I
believe it should be fixed by just checking v!=0 and
giving a msg about mmap not supporting slice deletion,
just before line 666 in mmapmodule.c. Hopefully can
still be done for 2.1.1 final...?
Alex
----------------------------------------------------------------------
>Comment By: Thomas Wouters (twouters)
Date: 2001-07-16 08:49
Message:
Logged In: YES
user_id=34209
Actually, the crash happens both on a del of the slice and
of an item, and on UNIX as well as Windows -- and any other
platform that could compile it. It's been around at least
since 2.0, and probably forever.
Your diagnosis is spot-on, by the way, that made it easy to
fix :) Fixed in revision 2.32 (head) and 2.27.4.2 (2.1.1
tree) so it'll be fixed in Python 2.2a1 and Python 2.1.1-final.
----------------------------------------------------------------------
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=441664&group_id=5470