diff options
author | Jo-Philipp Wich <jo@mein.io> | 2024-10-16 11:43:31 +0200 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2024-10-17 09:15:21 +0200 |
commit | 736d4508420222321468feedd60e7cb5063b574d (patch) | |
tree | 8d4680166f8bfc5202165ac9bc08677590e2a2b1 /docs | |
parent | 9cf53dda36bc25b513ec1b1cdfc851a10b37473f (diff) |
types: fix potential use after free on adding keys during iteration
When keys are added to the object currently being iterated by a for loop,
the insert operation might cause a hashtable resize with a subsequent
memory reallocation and a different table base pointer, clobbering the
entry pointers held by iterators pointing to the containing object of the
resized table.
In order to address this issue while keeping the iteration overhead low,
extend the object key insert logic to check whether the insertion will
trigger a reallocation and backup and restore the iterator pointers when
needed.
This slightly increases the size of the iterator states but the overhead
for this should be neglectible as there'll only be a low amount of
concurrently active iterations at any time.
Fixes: #230
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'docs')
0 files changed, 0 insertions, 0 deletions