[issue33312] ubsan undefined behavior sanitizer flags struct _dictkeysobject (PyDictKeysObj)

Benjamin Peterson report at bugs.python.org
Thu Apr 19 00:25:41 EDT 2018


Benjamin Peterson <benjamin at python.org> added the comment:

Yeah, I've run into this before. The "correct" thing to do is use C99 VLAs. Unfortunately, that doesn't work for PyDictKeysObject because it really wants a union of VLAs but that isn't supported. The best I could do is making a struct for every possible member of the union. See the attached patch. I didn't land it because it's gross. OTOH, undefined behavior is bad, so I'm okay landing this if you don't find it too revolting.

----------
keywords: +patch
Added file: https://bugs.python.org/file47541/horrible.patch

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue33312>
_______________________________________


More information about the Python-bugs-list mailing list