AU: bsdiff: Expand pathological case where files differ by <8 bytes

Modify bsdiff to better handle the case where files differ by <8 bytes
in some regions, not limitting this case to linear traversal.

BUG=chromium-os:28552
TEST=Manual bsdiff of problematic files, update engine unit tests

Change-Id: I5b796977fc0e81d08b2e22abae48ae9e7dd2dba6
Reviewed-on: https://gerrit.chromium.org/gerrit/19270
Reviewed-by: Don Garrett <[email protected]>
Commit-Ready: Thieu Le <[email protected]>
Tested-by: Thieu Le <[email protected]>
This commit is contained in:
Thieu Le authored and Alex Deymo committed 2015-09-23 10:01:35 -07:00
1 parent e3fd60e9c3
commit d172820cb8
1 file changed
+6 -5
+6 -5
View File
@@ -206,11 +206,12 @@ int main(int argc,char *argv[])
(old[scan+lastoffset] == new[scan]))
oldscore--;
if (len==prev_len-1 &&
oldscore==prev_oldscore-1 &&
pos==prev_pos+1 &&
len>oldscore &&
len<=oldscore+8)
const off_t fuzz = 8;
if (prev_len-fuzz<=len && len<=prev_len &&
prev_oldscore-fuzz<=oldscore &&
oldscore<=prev_oldscore &&
prev_pos<=pos && pos <=prev_pos+fuzz &&
oldscore<=len && len<=oldscore+fuzz)
++num_less_than_eight;
else
num_less_than_eight=0;