homepage

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: Segfault when using re.finditer over mmap
Type: crash Stage:
Components: Versions: Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: alex, benjamin.peterson, fijall, mrabarnett, python-dev, skrah
Priority: normal Keywords:

Created on 2012年03月06日 18:00 by fijall, last changed 2022年04月11日 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
x.py fijall, 2012年03月06日 18:00
Messages (5)
msg155028 - (view) Author: Maciej Fijalkowski (fijall) * (Python committer) Date: 2012年03月06日 18:00
Example to get a segfault attached. Crashes under python3 as well.
msg155033 - (view) Author: Matthew Barnett (mrabarnett) * (Python triager) Date: 2012年03月06日 19:09
It segfaults because it attempts to access the buffer of an mmap that has been closed. It would be certainly be more friendly if it checked whether the mmap was still open and, if not, raised an exception instead.
msg155105 - (view) Author: Matthew Barnett (mrabarnett) * (Python triager) Date: 2012年03月07日 18:58
In the function "getstring" in _sre.c, the code obtains a pointer to the characters of the buffer and then releases the buffer.
There's a comment before the release:
 /* Release the buffer immediately --- possibly dangerous
 but doing something else would require some re-factoring
 */
 PyBuffer_Release(&view);
What's happening is that after the mmap is closed the pointer is no longer valid.
msg155121 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2012年03月07日 20:59
New changeset 10a79a33d09b by Benjamin Peterson in branch '3.2':
keep the buffer object around while we're using it (closes #14212)
http://hg.python.org/cpython/rev/10a79a33d09b
New changeset 17dfe24e5107 by Benjamin Peterson in branch 'default':
merge 3.2 (#14212)
http://hg.python.org/cpython/rev/17dfe24e5107 
msg155122 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2012年03月07日 21:00
I think 2.7 might be hopeless.
History
Date User Action Args
2022年04月11日 14:57:27adminsetgithub: 58420
2013年08月05日 13:08:04serhiy.storchakalinkissue13083 superseder
2012年03月07日 21:01:36benjamin.petersonsetstatus: open -> closed
resolution: fixed
2012年03月07日 21:00:15benjamin.petersonsetstatus: closed -> open

nosy: + benjamin.peterson
messages: + msg155122

resolution: fixed -> (no value)
stage: resolved ->
2012年03月07日 20:59:27python-devsetstatus: open -> closed

nosy: + python-dev
messages: + msg155121

resolution: fixed
stage: resolved
2012年03月07日 19:23:17skrahsetnosy: + skrah
2012年03月07日 19:01:36alexsetnosy: + alex
2012年03月07日 18:58:12mrabarnettsetmessages: + msg155105
2012年03月06日 19:09:31mrabarnettsetnosy: + mrabarnett
messages: + msg155033
2012年03月06日 18:00:15fijallcreate

AltStyle によって変換されたページ (->オリジナル) /