summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlhchavez <lhchavez@lhchavez.com>2020-04-02 07:34:55 -0700
committerlhchavez <lhchavez@lhchavez.com>2020-04-02 07:34:55 -0700
commit4d4c8e0a3dd9af6a14228686333d3d2098c86b04 (patch)
treef13659f809f9ba122caeedd6556bc1c067e6e74c
parentba59a4a2cc5c3ceec41ef92ea6bd60f28cae205f (diff)
downloadlibgit2-4d4c8e0a3dd9af6a14228686333d3d2098c86b04.tar.gz
Re-adding the "delta offset is zero" error case
-rw-r--r--src/pack.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/pack.c b/src/pack.c
index e0b2c78b6..4294a6e32 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;
}