shithub: git9

Download patch

ref: fbb2fb7c87d8edf58e22c84f575853dc9de79ac4
parent: 92791c4a5d028ee0080509b96c027a51c4d357b2
author: Ori Bernstein <ori@eigenstate.org>
date: Sun Jan 24 11:26:59 EST 2021

pack: fix off-by-one error in delta length

With very large files that only changed a bit,
we could generate an overly long delta copy.
This fixes the off by one and limits the delta
length to a valid one.

--- a/delta.c
+++ b/delta.c
@@ -179,7 +179,7 @@
 	p = s + n;
 	q = dt->base + b->off + n;
 	eb = dt->base + dt->nbase;
-	while(n < (1<<24)){
+	while(n < (1<<24)-1){
 		if(p == e || q == eb)
 			break;
 		if(*p != *q)