]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.12] gh-125118: don't copy arbitrary values to _Bool in the struct module (GH-12516...
authorSergey B Kirpichev <skirpichev@gmail.com>
Thu, 10 Oct 2024 14:56:49 +0000 (17:56 +0300)
committerGitHub <noreply@github.com>
Thu, 10 Oct 2024 14:56:49 +0000 (14:56 +0000)
commit67f8302b9c94079f73dba23eaa47443fcb6008ad
treed2731a9a30d04a6dab12d7c9cd54fc6cd256ead5
parent74df3a79d308d036e79b600b1e7850e7828e6b39
[3.12] gh-125118: don't copy arbitrary values to _Bool in the struct module (GH-125169) (#125265)

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 87d7315ac57250046372b0d9ae4619ba619c8c87)

Co-authored-by: Sam Gross <colesbury@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
Lib/test/test_struct.py
Misc/NEWS.d/next/Library/2024-10-09-07-09-00.gh-issue-125118.J9rQ1S.rst [new file with mode: 0644]
Modules/_struct.c