[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 04:39:29 -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: Windows
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Alex Martelli (aleax)
Assigned to: Nobody/Anonymous (nobody)
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


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

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