[New-bugs-announce] [issue5335] mmap can crash with tagname (on windows)
Hirokazu Yamamoto
report at bugs.python.org
Sat Feb 21 07:24:57 CET 2009
New submission from Hirokazu Yamamoto <ocean-city at m2.ccsnet.ne.jp>:
I noticed following code crashes on windows. Attached patch will fix this.
/////////////////////////////////////
// Crash code
import mmap, tempfile
f = tempfile.TemporaryFile()
m1 = mmap.mmap(f.fileno(), 1000, tagname="foo")
m2 = mmap.mmap(f.fileno(), 5000, tagname="foo") # use same tagname, but
larger size
print len(m2[:]) # crash
/////////////////////////////////////
// After patch applied
Traceback (most recent call last):
File "b.py", line 4, in <module>
m2 = mmap.mmap(f.fileno(), 5000, tagname="foo")
WindowsError: [Error 5] アクセスが拒否されました。(Access Denied)
[15495 refs]
/////////////////////////////////////
Calling MapViewOfFile with size 0 means "map entire file", so
m2 = mmap.mmap(f.fileno(), 5000, tagname="foo")
maps existing memory region sized 1000. But mmap thinks its size is
5000, no IndexError raised, and accessed illegal memory area and crashes.
----------
components: Extension Modules, Windows
files: fix_tagname_crash.patch
keywords: patch
messages: 82561
nosy: ocean-city
severity: normal
status: open
title: mmap can crash with tagname (on windows)
type: crash
versions: Python 2.6, Python 2.7, Python 3.0, Python 3.1
Added file: http://bugs.python.org/file13145/fix_tagname_crash.patch
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue5335>
_______________________________________
More information about the New-bugs-announce
mailing list