Fix an out-of-bounds read in assoc_next.

Found using HWASan.
This commit is contained in:
Peter Collingbourne 2020-10-20 13:36:53 -07:00 committed by Bjorn Andersson
parent ab5074fdd5
commit 1bcf3c83c9

View File

@ -128,7 +128,7 @@ const char *assoc_next(struct assoc *assoc, void **value, unsigned long *iter)
{ {
unsigned long it = *iter; unsigned long it = *iter;
while (!assoc->keys[it] && it < assoc->size) while (it < assoc->size && !assoc->keys[it])
it++; it++;
if (it == assoc->size) if (it == assoc->size)