commit 155669edfab02aaa2eb5e39ccd67f3e2c8e1ffb0
parent ecd91d96481c0f46cf268e51200b28e7d5d1d052
Author: Thieu Le <thieule@chromium.org>
Date: Thu, 24 Sep 2020 16:49:27 +1000
bsdiff: fix memcmp hang
Change-Id: Ib0a68789fdf725d126467cbd86ca7ae28817b06c
Reviewed-on: http://gerrit.chromium.org/gerrit/8179
Reviewed-by: Andrew de los Reyes <adlr@chromium.org>
Commit-Ready: Thieu Le <thieule@chromium.org>
Tested-by: Thieu Le <thieule@chromium.org>
Diffstat:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/util.c b/util.c
@@ -205,7 +205,7 @@ search(off_t *I, uint8_t *old, off_t oldsize, uint8_t *new, off_t newsize,
}
x = st + (en - st) / 2;
- if (memcmp(old + I[x], new, MIN(oldsize - I[x], newsize)) < 0)
+ if (memcmp(old + I[x], new, MIN(oldsize - I[x], newsize)) <= 0)
return search(I, old, oldsize, new, newsize, x, en, pos);
else
return search(I, old, oldsize, new, newsize, st, x, pos);