[Python-Dev] segfaults due to hash randomization in C OrderedDict

MRAB python at mrabarnett.plus.com
Fri May 22 00:41:47 CEST 2015

On 2015-05-21 23:17, Eric Snow wrote:
 > On Thu, May 21, 2015 at 4:06 PM, MRAB <python at mrabarnett.plus.com> wrote:
 > > On 2015-05-21 22:52, Eric Snow wrote:
 > >> Good catch.  Unfortunately, sticking "keys = ((PyDictObject
 > >> *)od)->ma_keys;" right after "hash = ..." did not make a difference.
 > >> I still get the same segfault.
 > >
 > > So, does it change sometimes?
 > The segfault is consistent if I use the same seed (e.g. 7):
 >   PYTHONHASHSEED=7 ./python -m test.regrtest -m test_basic 
 > Some seeds always segfault and some seeds never segfault.
OK, another thought.

In "_odict_get_index" again, you say that if the hash has changed, the 
dict might've
been resized, but could the dict be resized _without_ the hash changing?

Could the value of "keys" still become invalid even if the hash is the same?

More information about the Python-Dev mailing list