shithub: git9

Download patch

ref: 46f76b1cc90466f53febc6af005399ea96e14c54
parent: 6dddd4ae8262ae6de52fb40a14b534e709fcc484
author: Ori Bernstein <[email protected]>
date: Sat Oct 24 17:30:26 EDT 2020

packfiles: handle corrupt objects a bit better

Git would crash if there were corrupt objects, which
makes it hard to recover; now we return an error to
the caller.

--- a/pack.c
+++ b/pack.c
@@ -230,7 +230,7 @@
 	vlong o;
 
 	o = Boffset(b);
-	if(inflatezlib(d, bappend, b, breadc) == -1){
+	if(inflatezlib(d, bappend, b, breadc) == -1 || d->data == nil){
 		free(d->data);
 		return -1;
 	}