Ross Lagerwall <rosslagerw...@gmail.com> added the comment:

>From what I can see, this issue is in memoryview and allows memoryview to 
>export a readonly buffer as writable (because memoryview.getbuffer() removes 
>the writable flag from flags before calling the underlying buffer).

This causes segfaults when using mmap. 

If a bytes object is used as the underlying buffer, it allows the bytes object 
to be changed.

Given this code:

import io
b=b"XXXX"
m=memoryview(b)
i=io.BytesIO(b'ZZZZ')
i.readinto(m)
print(b)
print(b == b"XXXX")

The output is:
b'ZZZZ'
True

I think this is due to interning.

Anyway, attached is a patch which hopefully fixes the issue + a test.

----------
keywords: +patch
nosy: +rosslagerwall
Added file: http://bugs.python.org/file20437/i10451.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue10451>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to