Closed
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