This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: mmap can crash after resize failure (windows)
Type: crash Stage:
Components: Extension Modules Versions: Python 3.0, Python 3.1, Python 2.7, Python 2.6
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: ocean-city
Priority: normal Keywords: patch

Created on 2009-02-27 17:33 by ocean-city, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
fix_mmap_resize_v2.patch ocean-city, 2009-03-02 17:54 use NULL as invalid handle value
Messages (3)
msg82852 - (view) Author: Hirokazu Yamamoto (ocean-city) * (Python committer) Date: 2009-02-27 17:33
On windows, after mmap.resize fails, self->map_handle
becomes NULL, but it should become INVALID_HANDLE_VALUE otherwise
CHECK_VALID is passed through, it can cause crash like bellow.

import mmap
m = mmap.mmap(-1, 5)
try:
    m.resize(-1)
except WindowsError:
    pass
m[0] = '1' # crash

The patch is in r69942.
msg83027 - (view) Author: Hirokazu Yamamoto (ocean-city) * (Python committer) Date: 2009-03-02 17:54
Or, use NULL as invalid handle value for map handle instead of
INVALID_HANDLE_VALUE. Maybe this is simpler.
msg83197 - (view) Author: Hirokazu Yamamoto (ocean-city) * (Python committer) Date: 2009-03-05 14:21
Fixed in r70189.
History
Date User Action Args
2022-04-11 14:56:46adminsetgithub: 49635
2009-03-05 14:21:36ocean-citysetstatus: open -> closed
resolution: fixed
messages: + msg83197
2009-03-02 17:54:06ocean-citysetfiles: + fix_mmap_resize_v2.patch
keywords: + patch
messages: + msg83027
2009-02-27 17:37:12ocean-citysettype: crash
2009-02-27 17:33:43ocean-citycreate