]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.13] 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:58:57 +0000 (17:58 +0300)
committerGitHub <noreply@github.com>
Thu, 10 Oct 2024 14:58:57 +0000 (14:58 +0000)
commitc2cb1a89b75f000842bf9626928155172b9ab069
tree615d2335e3992065ff5022a911473c6fb46fe56f
parent0c43d60e7d0edb2fd8f996091d96ba4e8350e72a
[3.13] gh-125118: don't copy arbitrary values to _Bool in the struct module (GH-125169) (#125263)

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