Commit 4d4c8e0a3dd9af6a14228686333d3d2098c86b04

lhchavez 2020-04-02T07:34:55

Re-adding the "delta offset is zero" error case

diff --git a/src/pack.c b/src/pack.c
index e0b2c78..4294a6e 100644
--- a/src/pack.c
+++ b/src/pack.c
@@ -930,6 +930,9 @@ int get_delta_base(
 
 			git_oid_fromraw(&oid, base_info);
 			if ((entry = git_oidmap_get(p->idx_cache, &oid)) != NULL) {
+				if (entry->offset == 0)
+					return packfile_error("delta offset is zero");
+
 				*curpos += 20;
 				*delta_base_out = entry->offset;
 				return 0;
@@ -949,6 +952,9 @@ int get_delta_base(
 	} else
 		return packfile_error("unknown object type");
 
+	if (base_offset == 0)
+		return packfile_error("delta offset is zero");
+
 	*delta_base_out = base_offset;
 	return 0;
 }