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:
Gavin Howard 2022-11-06 12:31:07 -07:00
parent 09247332bf
commit 8e83f103a8
Signed by: gavin
GPG Key ID: 93D31C8CA4AB6C63
1 changed files with 1 additions and 1 deletions

View File

@ -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);