classification
Title: mmap crashes just on boundary.
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-17 09:35 by ocean-city, last changed 2009-02-17 10:13 by ocean-city. This issue is now closed.

Files
File name Uploaded Description Edit
fix_segfault_on_boundary.patch ocean-city, 2009-02-17 09:42
Messages (3)
msg82307 - (view) Author: Hirokazu Yamamoto (ocean-city) * (Python committer) Date: 2009-02-17 09:35
I noticed following code crashes. I'll post fix soon.

import mmap
import os

def main():
	align = mmap.ALLOCATIONGRANULARITY
	path = os.path.splitext(__file__)[0] + ".txt"
	with open(path, "w") as f:
		f.write("0" * align)
		f.write("1" * align)
		f.write("2" * align)
	with open(path, "r+") as f:
		m = mmap.mmap(f.fileno(), align)
	m[align] # crash
        m[align] = '1' # crash too

if __name__ == '__main__':
	main()
msg82308 - (view) Author: Hirokazu Yamamoto (ocean-city) * (Python committer) Date: 2009-02-17 09:42
Here is a patch.
msg82314 - (view) Author: Hirokazu Yamamoto (ocean-city) * (Python committer) Date: 2009-02-17 10:13
This is obvious bug (and fix is obvious too), so I've commited in r69714.
History
Date User Action Args
2009-02-17 10:13:42ocean-citysetstatus: open -> closed
resolution: fixed
messages: + msg82314
2009-02-17 09:42:11ocean-citysetfiles: + fix_segfault_on_boundary.patch
keywords: + patch
messages: + msg82308
2009-02-17 09:35:55ocean-citycreate