handle extreme dashes
Make searching indices unsigned so intermediate middle doesn't overflow. Verified fix runs test in skia:7675 successfully. R=reed@google.com Bug: skia:7675 Change-Id: I76be1d3fee8875ae9eb2b18eb070ef66c8006c03 Reviewed-on: https://skia-review.googlesource.com/114798 Reviewed-by: Cary Clark <caryclark@skia.org> Commit-Queue: Cary Clark <caryclark@skia.org>
This commit is contained in:
parent
486ee3d4c6
commit
9475aa0f90
@ -528,11 +528,11 @@ int SkTKSearch(const T base[], int count, const K& key) {
|
||||
|
||||
SkASSERT(base != nullptr); // base may be nullptr if count is zero
|
||||
|
||||
int lo = 0;
|
||||
int hi = count - 1;
|
||||
unsigned lo = 0;
|
||||
unsigned hi = count - 1;
|
||||
|
||||
while (lo < hi) {
|
||||
int mid = (hi + lo) >> 1;
|
||||
unsigned mid = (hi + lo) >> 1;
|
||||
if (base[mid].fDistance < key) {
|
||||
lo = mid + 1;
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user