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
Title: PyArg_Parse*() functions: reject discontinious buffers
Type: Stage:
Components: Interpreter Core Versions: Python 3.2
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: vstinner
Priority: normal Keywords: patch

Created on 2010-06-13 20:37 by vstinner, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
reject_discontigious.patch vstinner, 2010-06-14 22:14
Messages (3)
msg107749 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2010-06-13 20:37
getbuffer() checks that the buffer is contiguous. "s#", "y", "z" formats use convertbuffer() which doesn't check that the buffer is contigious, as "w" and "w#" formats which call directly PyObject_GetBuffer() which extra check.

I don't think that the functions using these format support discontiguous buffers. I cannot check because I don't know how to create such buffer. It would be safer to reject discontigious buffer.

If a function would like to support discontigious buffer, it should use "O" format, call PyObject_GetBuffer() with the right option and do its own checks on the buffer object.
msg107820 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2010-06-14 22:14
Write a patch. test_getargs2.py has now tests for many byte and unicode formats and so it can validate the patch.
msg111753 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2010-07-28 00:41
Commited to 3.2 (r83197).
History
Date User Action Args
2022-04-11 14:57:02adminsetgithub: 53237
2010-07-28 00:41:41vstinnersetstatus: open -> closed
resolution: fixed
messages: + msg111753
2010-06-14 22:14:56vstinnersetfiles: + reject_discontigious.patch
keywords: + patch
messages: + msg107820
2010-06-13 20:37:35vstinnercreate