disas/libvixl/vixl/invalset.h: possible dodgy code in binary search ?
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
QEMU |
Invalid
|
Undecided
|
Unassigned |
Bug Description
[qemu/disas/
Source code is
while (!IsValid(
Also:
qemu/disas/
The source code is
while (!IsValid(
Mind you, these lines of code look similar but didn't get reported:
while (!IsValid(
while (!IsValid(
Given that binary search is notoriously tricky to get correct and a standard C library routine
I am puzzled as to why the standard library routine didn't get used, with of course a custom
comparison function.
That doesn't look like a bounds check to me, so I think your checker is producing false positives.
libvixl is third-party code in any case, so stylistic questions are better directed to them upstream. But I think the difference between this code and a standard binary search is (as the comment says) that it ignores invalid elements in the array.