Skip to content

[3.13] gh-125118: don't copy arbitrary values to _Bool in the struct module (GH-125169) #125263

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 10, 2024

Conversation

skirpichev
Copy link
Contributor

@skirpichev skirpichev commented Oct 10, 2024

memcopy'ing arbitrary values to _Bool variable triggers undefined behaviour. Avoid this.
We assume that false is represented by all zero bytes.

Credits to Alex Gaynor.

(cherry picked from commit 87d7315)

…truct module (pythonGH-125169)

memcopy'ing arbitrary values to _Bool variable triggers undefined
behaviour. Avoid this.
We assume that `false` is represented by all zero bytes.

Credits to Alex Gaynor.

(cherry picked from commit 87d7315)

Co-authored-by: Sergey B Kirpichev <[email protected]>
Co-authored-by: Sam Gross <[email protected]>
Co-authored-by: Victor Stinner <[email protected]>
Co-authored-by: Petr Viktorin <[email protected]>
Copy link
Member

@vstinner vstinner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@vstinner vstinner enabled auto-merge (squash) October 10, 2024 14:53
@vstinner vstinner merged commit c2cb1a8 into python:3.13 Oct 10, 2024
39 checks passed
@skirpichev skirpichev deleted the backport-87d7315-3.13 branch October 10, 2024 15:32
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