-
-
Notifications
You must be signed in to change notification settings - Fork 34k
gh-144281: Fix crash on memoryview slice assignment with shared memory #144284
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
Changes from all commits
4cfbb0a
6745906
96d7a42
ad0591c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| Fix a possible interpreter crash during memoryview slice assignment when the | ||
| underlying buffer is backed by shared memory. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2656,6 +2656,11 @@ memory_ass_sub(PyObject *_self, PyObject *key, PyObject *value) | |
|
|
||
| CHECK_RELEASED_INT(self); | ||
|
|
||
| if (view->buf == NULL) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is not clear this is a necessary or sufficient fix without a valid specific trigger.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I’ve updated the test that should also make the need for the view->buf NULL check clearer.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The issue is moot since this has been closed, but I'm afraid this still wouldn't have been useful. Your fix is unrelated to the test; it passes with or without it. It is good practice to always run your test scripts against affected versions, to confirm it reproduces the bug. Without that you don't know the test works. Also note the bug in the OP is a |
||
| PyErr_SetString(PyExc_BufferError, "memoryview: underlying buffer is no longer valid"); | ||
| return -1; | ||
| } | ||
|
|
||
| fmt = adjust_fmt(view); | ||
| if (fmt == NULL) | ||
| return -1; | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.