New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MemoryView_FromObject crashes if PyBuffer_GetBuffer fails #51634
Comments
In Objects/memoryobject.c:PyMemoryView_FromObject there's a PyMemoryView_FromObject(PyObject *base) {
...
if (PyObject_GetBuffer(base, &(mview->view), PyBUF_FULL_RO) < 0) {
Py_DECREF(mview);
return NULL;
}
...
_PyObject_GC_TRACK(mview);
}
...
static void memory_dealloc(PyMemoryViewObject *self) {
_PyObject_GC_UNTRACK(self);
....
} |
Nice catch. I wonder whether there's a simple way of cooking up an unit |
Proposed test and fix. |
Removed /* XXX */ code |
When PyMemoryView_FromObject() doesn't return NULL, you should decref the result. Otherwise, it's "perfect". |
Thanks. |
I've added a missing call to PyBuffer_Release() and committed the patch to trunk (r77916). |
Merged in r77918 (py3k) and r77920 (3.1). |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: