FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

[3.15] gh-159739: Handle overlapping buffers in struct.pack_into (GH-159985) by miss-islington · Pull Request #160101 · python/cpython · GitHub

Repository navigation

[3.15] gh-159739: Handle overlapping buffers in struct.pack_into (GH-159985) - #160101

Open
miss-islington wants to merge 1 commit into
python:3.15from
miss-islington:backport-31a7d99-3.15
Open

miss-islington wants to merge 1 commit into
python:3.15from
miss-islington:backport-31a7d99-3.15

Conversation

miss-islington commented Oct 21, 2026 •
edited by bedevere-app Bot
Loading

Copy link
Copy Markdown
Contributor

struct.pack_into() can use the same bytearray as both the destination and an s or p value. The copy then passes overlapping regions to memcpy, which is undefined in C and can produce platform-dependent results or a sanitizer abort. memmove makes the overlapping copy defined.
(cherry picked from commit 31a7d99)

Co-authored-by: Jelle Zijlstra jelle@openai.com

…onGH-159985)

`struct.pack_into()` can use the same bytearray as both the destination and an `s` or `p` value. The copy then passes overlapping regions to `memcpy`, which is undefined in C and can produce platform-dependent results or a sanitizer abort. `memmove` makes the overlapping copy defined.
(cherry picked from commit 31a7d99)

Co-authored-by: Jelle Zijlstra <jelle@openai.com>
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL