Preemptively fix a bug found on HN
This bug probably couldn't be triggered, so I won't do a release, but it could result in overflow when doing a binary search. See https://news.ycombinator.com/item?id=33492122 . Signed-off-by: Gavin Howard <[email protected]>
This commit is contained in:
parent
09247332bf
commit
8e83f103a8
|
@ -418,7 +418,7 @@ bc_map_find(const BcVec* restrict v, const char* name)
|
|||
|
||||
while (low < high)
|
||||
{
|
||||
size_t mid = (low + high) / 2;
|
||||
size_t mid = low + (high - low) / 2;
|
||||
const BcId* id = bc_vec_item(v, mid);
|
||||
int result = strcmp(name, id->name);
|
||||
|
||||
|
|
Loadingâ¦
Reference in New Issue