summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlhchavez <lhchavez@lhchavez.com>2017-12-15 15:01:50 +0000
committerlhchavez <lhchavez@lhchavez.com>2017-12-15 15:01:50 +0000
commit53f2c6b1d8907e1716ea4eb643868da445e36f54 (patch)
treee113813050a974cac0dc1b44879704199a4c2ce0
parente7fac2af238ec1eff706d6605985ee5bdfaeb2ea (diff)
downloadlibgit2-53f2c6b1d8907e1716ea4eb643868da445e36f54.tar.gz
Simplified overflow condition
-rw-r--r--src/pack.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/pack.c b/src/pack.c
index e0a393817..b87d22d53 100644
--- a/src/pack.c
+++ b/src/pack.c
@@ -944,11 +944,9 @@ git_off_t get_delta_base(
c = base_info[used++];
unsigned_base_offset = (unsigned_base_offset << 7) + (c & 127);
}
- if ((size_t)delta_obj_offset <= unsigned_base_offset)
+ if (unsigned_base_offset == 0 || (size_t)delta_obj_offset <= unsigned_base_offset)
return 0; /* out of bound */
base_offset = delta_obj_offset - unsigned_base_offset;
- if (base_offset >= delta_obj_offset)
- return 0; /* out of bound */
*curpos += used;
} else if (type == GIT_OBJ_REF_DELTA) {
/* If we have the cooperative cache, search in it first */