New submission from Armin Rigo:

Following the documentation at https://docs.python.org/3/c-api/buffer.html, if 
we write a custom object in C with a getbufferproc that simply returns 
PyBuffer_FillInfo(...), then it works fine up to Python 3.2 but segfaults in 
Python 3.3 depending on what we do with it.  The segfault is caused by 
memoryobject.c:last_dim_is_contiguous(), which reads from the "strides" array 
without checking that it is not NULL.

Attached the simplest example of C extension module I could make.  When 
executing this:

>>> import xy
>>> m=memoryview(bytearray(b"abcdef"))
>>> m[:5] = xy.gm

...it segfaults in Python 3.3.  (I'm told it works fine in 3.2 and segfaults in 
3.4 as well, but didn't confirm it.)

----------
messages: 220721
nosy: arigo
priority: normal
severity: normal
status: open
title: PyBuffer_FillInfo() from 3.3

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

Reply via email to