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.

Author arigo
Recipients arigo
Date 2014-06-16.14:03:24
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1402927404.66.0.0840543943961.issue21778@psf.upfronthosting.co.za>
In-reply-to
Content
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.)
History
Date User Action Args
2014-06-16 14:03:24arigosetrecipients: + arigo
2014-06-16 14:03:24arigosetmessageid: <1402927404.66.0.0840543943961.issue21778@psf.upfronthosting.co.za>
2014-06-16 14:03:24arigolinkissue21778 messages
2014-06-16 14:03:24arigocreate