Skip to content

gh-146196: Fix potential Undefined Behavior in _PyUnicodeWriter_WriteASCIIString#146201

Merged
vstinner merged 2 commits intopython:mainfrom
ashm-dev:ub
Mar 20, 2026
Merged

gh-146196: Fix potential Undefined Behavior in _PyUnicodeWriter_WriteASCIIString#146201
vstinner merged 2 commits intopython:mainfrom
ashm-dev:ub

Conversation

@ashm-dev
Copy link
Contributor

@ashm-dev ashm-dev commented Mar 20, 2026

@vstinner vstinner added the needs backport to 3.14 bugs and security fixes label Mar 20, 2026
@vstinner vstinner enabled auto-merge (squash) March 20, 2026 15:34
@vstinner vstinner merged commit cd10a2e into python:main Mar 20, 2026
52 checks passed
@miss-islington-app
Copy link

Thanks @ashm-dev for the PR, and @vstinner for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14.
🐍🍒⛏🤖 I'm not a witch! I'm not a witch!

@miss-islington-app
Copy link

Sorry, @ashm-dev and @vstinner, I could not cleanly backport this to 3.14 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker cd10a2e65c25682095f6ee4a9b9a181938a50d2e 3.14

vstinner added a commit to vstinner/cpython that referenced this pull request Mar 20, 2026
…IString() (python#146201)

Avoid calling memcpy(data + writer->pos, NULL, 0)
which has an undefined behavior.

Co-authored-by: Victor Stinner <vstinner@python.org>
(cherry picked from commit cd10a2e)
@bedevere-app
Copy link

bedevere-app bot commented Mar 20, 2026

GH-146220 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.14 bugs and security fixes label Mar 20, 2026
@ashm-dev ashm-dev deleted the ub branch March 20, 2026 16:02
vstinner added a commit that referenced this pull request Mar 20, 2026
…IIString() (#146201) (#146220)

gh-146196: Fix Undefined Behavior in _PyUnicodeWriter_WriteASCIIString() (#146201)

Avoid calling memcpy(data + writer->pos, NULL, 0)
which has an undefined behavior.


(cherry picked from commit cd10a2e)

Co-authored-by: Shamil <ashm.tech@proton.me>
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.

2 participants