diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2011-02-24 20:50:49 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2011-02-24 20:50:49 (GMT) |
commit | 5bffa79c227236a8bfde6bf174a1f3f0a43fd2ea (patch) | |
tree | c755754b167f2c992e610dab9a6dfe7c6ff59511 /Objects/memoryobject.c | |
parent | 1ce92dc20d698ce46c3459da7801c76bb8518550 (diff) | |
download | cpython-5bffa79c227236a8bfde6bf174a1f3f0a43fd2ea.zip cpython-5bffa79c227236a8bfde6bf174a1f3f0a43fd2ea.tar.gz cpython-5bffa79c227236a8bfde6bf174a1f3f0a43fd2ea.tar.bz2 |
Issue #11286: Raise a ValueError from calling PyMemoryView_FromBuffer with
a buffer struct having a NULL data pointer.
Diffstat (limited to 'Objects/memoryobject.c')
-rw-r--r-- | Objects/memoryobject.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Objects/memoryobject.c b/Objects/memoryobject.c index 7782076..2e32b2a 100644 --- a/Objects/memoryobject.c +++ b/Objects/memoryobject.c @@ -75,6 +75,11 @@ PyMemoryView_FromBuffer(Py_buffer *info) { PyMemoryViewObject *mview; + if (info->buf == NULL) { + PyErr_SetString(PyExc_ValueError, + "cannot make memory view from a buffer with a NULL data pointer"); + return NULL; + } mview = (PyMemoryViewObject *) PyObject_GC_New(PyMemoryViewObject, &PyMemoryView_Type); if (mview == NULL) |