Skip to content

Commit 53f2c6b

Browse files
committed
Simplified overflow condition
1 parent e7fac2a commit 53f2c6b

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

src/pack.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -944,11 +944,9 @@ git_off_t get_delta_base(
944944
c = base_info[used++];
945945
unsigned_base_offset = (unsigned_base_offset << 7) + (c & 127);
946946
}
947-
if ((size_t)delta_obj_offset <= unsigned_base_offset)
947+
if (unsigned_base_offset == 0 || (size_t)delta_obj_offset <= unsigned_base_offset)
948948
return 0; /* out of bound */
949949
base_offset = delta_obj_offset - unsigned_base_offset;
950-
if (base_offset >= delta_obj_offset)
951-
return 0; /* out of bound */
952950
*curpos += used;
953951
} else if (type == GIT_OBJ_REF_DELTA) {
954952
/* If we have the cooperative cache, search in it first */

0 commit comments

Comments
 (0)