]> git.ipfire.org Git - thirdparty/bind9.git/commit
Fix the assertion failure in the isc_hashmap iterator
authorOndřej Surý <ondrej@isc.org>
Mon, 12 Aug 2024 13:17:00 +0000 (15:17 +0200)
committerOndřej Surý <ondrej@isc.org>
Wed, 14 Aug 2024 15:19:04 +0000 (15:19 +0000)
commitacdc57259f18b40adeddbafa53a2a01ae97b00a4
tree4dc07a2a07f25648fa38fb6e5fc81638901907c7
parent482eed2e3109d6d3c3cb601ad45883162a69f59b
Fix the assertion failure in the isc_hashmap iterator

When the round robin hashing reorders the map entries on deletion, we
were adjusting the iterator table size only when the reordering was
happening at the internal table boundary.  The iterator table size had
to be reduced by one to prevent seeing the entry that resized on
position [0] twice because it migrated to [iter->size - 1] position.

However, the same thing could happen when the same entry migrates a
second time from [iter->size - 1] to [iter->size - 2] position (and so
on) because the check that we are manipulating the entry just in the [0]
position was insufficient.  Instead of checking the position [pos == 0],
we now check that the [pos % iter->size == 0], thus ignoring all the
entries that might have moved back to the end of the internal table.
lib/isc/hashmap.c