mirror of
https://github.com/python/cpython.git
synced 2025-07-07 19:35:27 +00:00
[3.11] gh-127563: use dk_log2_index_bytes=3
in empty dicts (GH-127568) (GH-127813) (#135463)
Some checks failed
Lint / lint (push) Has been cancelled
Tests / Check for source changes (push) Has been cancelled
Tests / Docs (push) Has been cancelled
Tests / Check if the ABI has changed (push) Has been cancelled
Tests / Check if generated files are up to date (push) Has been cancelled
Tests / Windows (push) Has been cancelled
Tests / macOS (push) Has been cancelled
Tests / Ubuntu (push) Has been cancelled
Tests / Ubuntu SSL tests with OpenSSL (push) Has been cancelled
Tests / Address sanitizer (push) Has been cancelled
Tests / All required checks pass (push) Has been cancelled
Some checks failed
Lint / lint (push) Has been cancelled
Tests / Check for source changes (push) Has been cancelled
Tests / Docs (push) Has been cancelled
Tests / Check if the ABI has changed (push) Has been cancelled
Tests / Check if generated files are up to date (push) Has been cancelled
Tests / Windows (push) Has been cancelled
Tests / macOS (push) Has been cancelled
Tests / Ubuntu (push) Has been cancelled
Tests / Ubuntu SSL tests with OpenSSL (push) Has been cancelled
Tests / Address sanitizer (push) Has been cancelled
Tests / All required checks pass (push) Has been cancelled
[3.12] gh-127563: use `dk_log2_index_bytes=3` in empty dicts (GH-127568) (GH-127813) This fixes a UBSan failure (unaligned zero-size memcpy) in `dictobject.c`. (cherry picked from commit9af96f4406
) (cherry picked from commit320a1dcd97
) Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
This commit is contained in:
parent
c96ab19ae4
commit
313544eb03
1 changed files with 4 additions and 1 deletions
|
@ -449,11 +449,14 @@ estimate_log2_keysize(Py_ssize_t n)
|
|||
|
||||
/* This immutable, empty PyDictKeysObject is used for PyDict_Clear()
|
||||
* (which cannot fail and thus can do no allocation).
|
||||
*
|
||||
* See https://github.com/python/cpython/pull/127568#discussion_r1868070614
|
||||
* for the rationale of using dk_log2_index_bytes=3 instead of 0.
|
||||
*/
|
||||
static PyDictKeysObject empty_keys_struct = {
|
||||
1, /* dk_refcnt */
|
||||
0, /* dk_log2_size */
|
||||
0, /* dk_log2_index_bytes */
|
||||
3, /* dk_log2_index_bytes */
|
||||
DICT_KEYS_UNICODE, /* dk_kind */
|
||||
1, /* dk_version */
|
||||
0, /* dk_usable (immutable) */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue