Skip to content

[3.13] gh-156939: Fix struct.pack('0p', bytes) (GH-157071) - #157131

Merged
vstinner merged 1 commit into
python:3.13from
miss-islington:backport-23525c9-3.13
Sep 7, 2026
Merged

[3.13] gh-156939: Fix struct.pack('0p', bytes) (GH-157071)#157131
vstinner merged 1 commit into
python:3.13from
miss-islington:backport-23525c9-3.13

Conversation

@miss-islington

@miss-islington miss-islington commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

If the Pascal string is empty (size=0), do not write the size prefix.
Previously, a NUL byte was written outsize the buffer (buffer
overflow). In practice, the write remains into allocated memory
and is silently ignored: no memory is corrupted.
(cherry picked from commit 23525c9)

Co-authored-by: Victor Stinner vstinner@python.org

If the Pascal string is empty (size=0), do not write the size prefix.
Previously, a NUL byte was written outsize the buffer (buffer
overflow). In practice, the write remains into allocated memory
and is silently ignored: no memory is corrupted.
(cherry picked from commit 23525c9)

Co-authored-by: Victor Stinner <vstinner@python.org>
@vstinner
vstinner enabled auto-merge (squash) September 7, 2026 19:33
@vstinner
vstinner merged commit 1c5df82 into python:3.13 Sep 7, 2026
43 checks passed
@miss-islington
miss-islington deleted the backport-23525c9-3.13 branch September 7, 2026 19:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants