avoid-overflow-with-simplehash-start-iterate.patch
application/octet-stream
Filename: avoid-overflow-with-simplehash-start-iterate.patch
Type: application/octet-stream
Part: 0
Message:
Avoid overflow with simplehash
Patch
Format: unified
| File | + | − |
|---|---|---|
| src/include/lib/simplehash.h | 3 | 3 |
diff --git a/src/include/lib/simplehash.h b/src/include/lib/simplehash.h
index 48db837ec8..d7711781de 100644
--- a/src/include/lib/simplehash.h
+++ b/src/include/lib/simplehash.h
@@ -964,8 +964,8 @@ SH_DELETE_ITEM(SH_TYPE * tb, SH_ELEMENT_TYPE * entry)
SH_SCOPE void
SH_START_ITERATE(SH_TYPE * tb, SH_ITERATOR * iter)
{
- int i;
- uint64 startelem = PG_UINT64_MAX;
+ uint32 i;
+ uint32 startelem = PG_UINT32_MAX;
/*
* Search for the first empty element. As deletions during iterations are
@@ -983,7 +983,7 @@ SH_START_ITERATE(SH_TYPE * tb, SH_ITERATOR * iter)
}
}
- Assert(startelem < SH_MAX_SIZE);
+ Assert(startelem < PG_UINT32_MAX);
/*
* Iterate backwards, that allows the current element to be deleted, even