Commit 98bc99bea839936142a3749f3866e5bc51790370

Vicent Martí 2011-08-04T16:48:56

Merge pull request #352 from carlosmn/delta-base-error Check for error calculating the delta base

1
2
3
4
5
6
7
8
9
10
11
12
13
diff --git a/src/pack.c b/src/pack.c
index f7bad2f..c84f007 100644
--- a/src/pack.c
+++ b/src/pack.c
@@ -298,6 +298,8 @@ static int packfile_unpack_delta(
 	base_offset = get_delta_base(p, w_curs, curpos, delta_type, obj_offset);
 	if (base_offset == 0)
 		return git__throw(GIT_EOBJCORRUPTED, "Delta offset is zero");
+	if (base_offset < 0)
+		return git__rethrow(base_offset, "Failed to get delta base");
 
 	git_mwindow_close(w_curs);
 	error = git_packfile_unpack(&base, p, &base_offset);