Branch: Tag:

2017-06-09

2017-06-09 12:56:01 by Tobias S. Josefowitz <tobij@tobij.de>

Builtin: random(mapping) no longer exposes PIKE_T_FREE to Pike

Off by one error caused random(mapping) to return elements from the
mapping's freelist.

Fixes [LysLysKOM 22108453] reported by Per Cederqvist. Thanks!

1485:    /* Find a random, nonempty bucket */    bucket=my_rand() % md->hashsize;    while(! md->hash[bucket] ) -  if(++bucket > (size_t)md->hashsize) +  if(++bucket >= (size_t)md->hashsize)    bucket=0;       /* Count entries in bucket */