• Gregory P. Smith's avatar
    bpo-33312: Fix clang ubsan out of bounds warnings in dict. (GH-6537) · 397f1b28
    Gregory P. Smith yazdı
    Fix clang ubsan (undefined behavior sanitizer) warnings in dictobject.c by
    adjusting how the internal struct _dictkeysobject shared keys structure is
    declared.
    
    This remains ABI compatible.  We get rid of the union at the end of the
    struct being used for conveinence to avoid typecasting in favor of char[]
    variable length array at the end of a struct. This is known to clang to be
    used for variable sized objects and will not cause an undefined behavior
    problem.  Similarly, char arrays do not have strict aliasing undefined
    behavior when cast.
    
    PEP-007 does not currently list variable length arrays (VLAs) as allowed
    in our subset of C99.  If this turns out to be a problem, the fix to this is
    to change the char `dk_indices[]` into `dk_indices[1]` and restore the
    three size computation subtractions this change removes:
      `- Py_MEMBER_SIZE(PyDictKeysObject, dk_indices)`
    
    If this works as is I'll make a separate PR to update PEP-007.
    397f1b28
Adı
Son kayıt (commit)
Son güncelleme
.github Loading commit data...
Doc Loading commit data...
Grammar Loading commit data...
Include Loading commit data...
Lib Loading commit data...
Mac Loading commit data...
Misc Loading commit data...
Modules Loading commit data...
Objects Loading commit data...
PC Loading commit data...
PCbuild Loading commit data...
Parser Loading commit data...
Programs Loading commit data...
Python Loading commit data...
Tools Loading commit data...
m4 Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
.travis.yml Loading commit data...
LICENSE Loading commit data...
Makefile.pre.in Loading commit data...
README.rst Loading commit data...
aclocal.m4 Loading commit data...
config.guess Loading commit data...
config.sub Loading commit data...
configure Loading commit data...
configure.ac Loading commit data...
install-sh Loading commit data...
pyconfig.h.in Loading commit data...
setup.py Loading commit data...