summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarlos Martín Nieto <carlos@cmartin.tk>2011-08-04 22:51:46 +0200
committerCarlos Martín Nieto <carlos@cmartin.tk>2011-08-04 22:51:46 +0200
commit97f40a0d5c100cacbeea113445a79a6622d1325a (patch)
tree508998d461c982d3b5d58c7b0db74a8cbcfef6ac /src
parent31bf5f38575fdffb27326a2b2bae88d096bb0071 (diff)
downloadlibgit2-97f40a0d5c100cacbeea113445a79a6622d1325a.tar.gz
Check for error calculating the delta base
Don't assume that it's always going to work. Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
Diffstat (limited to 'src')
-rw-r--r--src/pack.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/pack.c b/src/pack.c
index f7bad2f80..c84f007bc 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);