Commit 8f189cbf by lhchavez Committed by Patrick Steinhardt

Simplified overflow condition

parent feb00daf
...@@ -944,11 +944,9 @@ git_off_t get_delta_base( ...@@ -944,11 +944,9 @@ git_off_t get_delta_base(
c = base_info[used++]; c = base_info[used++];
unsigned_base_offset = (unsigned_base_offset << 7) + (c & 127); 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 */ return 0; /* out of bound */
base_offset = delta_obj_offset - unsigned_base_offset; base_offset = delta_obj_offset - unsigned_base_offset;
if (base_offset >= delta_obj_offset)
return 0; /* out of bound */
*curpos += used; *curpos += used;
} else if (type == GIT_OBJ_REF_DELTA) { } else if (type == GIT_OBJ_REF_DELTA) {
/* If we have the cooperative cache, search in it first */ /* If we have the cooperative cache, search in it first */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment