Skip to content

gh-156939: Detect buffer overflow in PyBytesWriter in debug mode - #156943

Draft
vstinner wants to merge 2 commits into
python:mainfrom
vstinner:writer_canary
Draft

gh-156939: Detect buffer overflow in PyBytesWriter in debug mode#156943
vstinner wants to merge 2 commits into
python:mainfrom
vstinner:writer_canary

Conversation

@vstinner

@vstinner vstinner commented Sep 4, 2026

Copy link
Copy Markdown
Member

Reserve one byte in PyBytesWriter used as a canary byte: set it to a special value. PyBytesWriter_Finish() checks if the canary byte has been overriden. Add a test on the feature.

Tests: only run the 3 "example" tests in BytesWriterTest. There is no need to rerun them in ByteArrayWriterTest.

Reserve one byte in PyBytesWriter used as a canary byte: set it to a
special value. PyBytesWriter_Finish() checks if the canary byte has
been overriden. Add a test on the feature.

Tests: only run the 3 "example" tests in BytesWriterTest. There is no
need to rerun them in ByteArrayWriterTest.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant