bsdiff: Speed up pathological case.

bsdiff does not properly handle the case where there is a large block of
data in the new file that only differs from the old file by less than 8
bytes.  This causes bsdiff to continue searching through the files one
byte at a time and at each byte, re-compare the same large block of data
which leads to excessively long run times.  This fix checks for this
edge condition and breaks out of the search loop early.  This retains
the size efficiency of the patch file for most binaries while preserving
the runtime efficiency for files that fall into this category.

BUG=chromium-os:16377
TEST=unit tests, manually applied update, bsdiff known problematic files

Change-Id: If84ad928603c71297f4d0977405893345f39d5c3
Reviewed-on: http://gerrit.chromium.org/gerrit/2640
Reviewed-by: Andrew de los Reyes <adlr@chromium.org>
Tested-by: Thieu Le <thieule@chromium.org>
1 file changed