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.

TEST=unit tests, manually applied update, bsdiff known problematic files

Change-Id: If84ad928603c71297f4d0977405893345f39d5c3
Reviewed-by: Andrew de los Reyes <>
Tested-by: Thieu Le <>
1 file changed
tree: 89a86008cf1ebdcc8f4039cda997c47ed501d1ba
  1. bsdiff.1
  2. bsdiff.c
  3. bspatch.1
  4. bspatch.c
  5. Makefile