Repository navigation
[2.7] bpo-27195: Fix crashes in io.BufferedReader() and io.BufferedWriter() - #8415
Closed
ZackerySpytz wants to merge 3 commits into
Closed
ZackerySpytz wants to merge 3 commits into
ZackerySpytz wants to merge 3 commits into
Conversation
…iter() In _bufferedreader_raw_read() and _bufferedwriter_raw_write(), PyBUF_FORMAT should be included in the flags passed to PyBuffer_FillInfo() (unlike in Python 3, PyMemoryView_FromBuffer() will not set the format of the memoryview's buffer if the passed buffer's format is NULL).
serhiy-storchaka
approved these changes
Aug 24, 2018
serhiy-storchaka
left a comment
Member
There was a problem hiding this comment.
LGTM. This workaround fixes the issue in this concrete case, and it looks safe enough.
But would be nice to add more details in the news entry.
| @@ -0,0 +1,2 @@ | |||
| Fix crashes in :class:`io.BufferedReader` and :class:`io.BufferedWriter`. | |||
Member
There was a problem hiding this comment.
Please add a tiny bit more details.
The crash is occurred also when call tolist().
ZackerySpytz
force-pushed
the
bpo-27195-io-format-crashes
branch
from
August 27, 2018 16:58
fa3f542 to
b802e44
Compare
|
I respectfully disagree with this fix. The Py_buffer documentation says that it is valid for format to be NULL, and that it means "B". So IMO the |
|
Created #9615 with my proposed fix. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In _bufferedreader_raw_read() and _bufferedwriter_raw_write(),
PyBUF_FORMAT should be included in the flags passed to
PyBuffer_FillInfo() (unlike in Python 3, PyMemoryView_FromBuffer()
will not set the format of the memoryview's buffer if the passed
buffer's format is NULL).
https://bugs.python.org/issue27195