]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
fix: dev: Fix the assertion failure in the isc_hashmap iterator
authorOndřej Surý <ondrej@isc.org>
Wed, 14 Aug 2024 15:19:11 +0000 (15:19 +0000)
committerOndřej Surý <ondrej@isc.org>
Wed, 14 Aug 2024 15:19:11 +0000 (15:19 +0000)
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.

Closes #4838

Merge branch '4838-fix-assertion-failure-in-hashmap-deletion-iterator' into 'main'

Closes #4838

See merge request isc-projects/bind9!9292


Trivial merge