From f6320d64cd0980146ecad40000c535eba6868c59 Mon Sep 17 00:00:00 2001 From: Max Wash Date: Sat, 13 Jun 2026 14:49:44 +0100 Subject: [PATCH] fx.collections: hashtable: add bounds checking to iterator --- fx.collections/hashtable.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fx.collections/hashtable.c b/fx.collections/hashtable.c index 54c556e..c2de440 100644 --- a/fx.collections/hashtable.c +++ b/fx.collections/hashtable.c @@ -623,6 +623,10 @@ static const fx_value *iterator_get_value(const fx_iterator *obj) struct table_item *table = it->_h_p->t_items; size_t capacity = primes[it->_h_p->t_max_index]; + if (it->i >= capacity) { + return NULL; + } + if (table[it->i].i_item) { return &it->item_value; }