-
-
Notifications
You must be signed in to change notification settings - Fork 33.4k
Closed
Labels
type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Bug report
Bug description:
When building with ubsan enabled, an unaligned access error gets triggered in dictobject.c. I triggered this on linux x86_64 when interpreting the following script:
import argparse
parser = argparse.ArgumentParser()Here's the ubsan error message:
thread 15767 panic: load of misaligned address 0x386b491 for type 'PyDictUnicodeEntry *', which requires 8 byte alignment
Objects/dictobject.c:1504:21: 0x2916e0e in dictresize (cpython/Objects/dictobject.c)
memcpy(newentries, oldentries, numentries * sizeof(PyDictUnicodeEntry));
^
Adding logs around the call to memcpy reveals that oldentries contains an unaligned value, but, numentries is also 0, which, means most implementations would probably do what the caller expects, namely, nothing.
CPython versions tested on:
3.11
Operating systems tested on:
Linux
Linked PRs
Metadata
Metadata
Assignees
Labels
type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error