add_asserts_to_simplehash_iterator_code.patch
application/octet-stream
Filename: add_asserts_to_simplehash_iterator_code.patch
Type: application/octet-stream
Part: 0
Patch
Same data as JSON:
GET /api/v1/attachments/:id/patch
the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes.
API reference →
Format: unified
| File | + | − |
|---|---|---|
| src/include/lib/simplehash.h | 4 | 0 |
diff --git a/src/include/lib/simplehash.h b/src/include/lib/simplehash.h
index 327274c2340..9622131ede6 100644
--- a/src/include/lib/simplehash.h
+++ b/src/include/lib/simplehash.h
@@ -1044,6 +1044,10 @@ SH_START_ITERATE_AT(SH_TYPE * tb, SH_ITERATOR * iter, uint32 at)
SH_SCOPE SH_ELEMENT_TYPE *
SH_ITERATE(SH_TYPE * tb, SH_ITERATOR * iter)
{
+ /* validate sanity of the given iterator */
+ Assert(iter->cur < tb->size);
+ Assert(iter->end < tb->size);
+
while (!iter->done)
{
SH_ELEMENT_TYPE *elem;