Issue 23349: PyBuffer_ToContiguous() off-by-one error for non-contiguous buffers (original) (raw)

Issue23349

Created on 2015-01-30 01:07 by rhansen, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
PyBuffer_ToContiguous.patch rhansen,2015-01-30 01:07 patch that fixes this bug
issue23349-2.diff skrah,2015-01-30 17:20
Messages (4)
msg235011 - (view) Author: Richard Hansen (rhansen) * Date: 2015-01-30 01:07
PyBuffer_ToContiguous() has an off-by-one error when copying a buffer it thinks is non-contiguous. To reproduce, put the following in foo.pyx and compile with Cython v0.21.2: cpdef foo(): cdef unsigned char[:] v = bytearray("testing") print repr(memoryview(v).tobytes()) >>> import foo >>> foo.foo() 'estingt' (This issue was fixed for Python 3.x in issue #12834 but it was not fixed for Python 2.7.)
msg235042 - (view) Author: Stefan Krah (skrah) * (Python committer) Date: 2015-01-30 17:20
Looks good, here's a patch with tests.
msg235048 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2015-01-30 19:11
New changeset a9305102c892 by Stefan Krah in branch '2.7': Issue #23349: Fix off-by-one error in PyBuffer_ToContiguous(). Initial patch https://hg.python.org/cpython/rev/a9305102c892
msg235109 - (view) Author: Stefan Krah (skrah) * (Python committer) Date: 2015-01-31 14:26
Should be fixed, thanks for the patch.
History
Date User Action Args
2022-04-11 14:58:12 admin set github: 67538
2015-01-31 14:26:07 skrah set status: open -> closedresolution: fixedmessages: + stage: resolved
2015-01-30 19:11:50 python-dev set nosy: + python-devmessages: +
2015-01-30 17:20:18 skrah set files: + issue23349-2.diffmessages: +
2015-01-30 14:35:07 skrah set nosy: + skrah
2015-01-30 06:30:12 rhansen set title: memoryview.to_bytes() and PyBuffer_ToContiguous() off-by-one error for non-contiguous buffers -> PyBuffer_ToContiguous() off-by-one error for non-contiguous buffers
2015-01-30 01:07:08 rhansen create