➜

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.

classification
标题: PyBuffer_ToContiguous() off-by-one error for non-contiguous buffers
类型: behavior Stage: resolved
Components: Interpreter Core Versions: Python 2.7
process
状态: closed Resolution: fixed
Dependencies: 后续:
分配给: 抄送列表: python-dev, rhansen, skrah
优先级: normal 关键字: patch

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

文件
文件名 上传时间 Description 编辑
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) * 日期: 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) 日期: 2015-01-30 17:20
Looks good, here's a patch with tests.
msg235048 - (view) Author: Roundup Robot (python-dev) (Python triager) 日期: 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) 日期: 2015-01-31 14:26
Should be fixed, thanks for the patch.
历史
日期 用户 动作 参数
2022-04-11 14:58:12admin修改github: 67538
2015-01-31 14:26:07skrah修改状态: open -> closed
resolution: fixed
消息: + msg235109

stage: resolved
2015-01-30 19:11:50python-dev修改抄送: + python-dev
消息: + msg235048
2015-01-30 17:20:18skrah修改文件: + issue23349-2.diff

消息: + msg235042
2015-01-30 14:35:07skrah修改抄送: + skrah
2015-01-30 06:30:12rhansen修改标题: 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:08rhansen创建