Skip to content

Commit 2d5b70d

Browse files
committed
Merge branch 'jt/pack-header-lshift-overflow'
The code to decode the length of packed object size has been corrected. * jt/pack-header-lshift-overflow: packfile: avoid overflowing shift during decode
2 parents a0f3df5 + 34de5b8 commit 2d5b70d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

packfile.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1068,7 +1068,7 @@ unsigned long unpack_object_header_buffer(const unsigned char *buf,
10681068
size = c & 15;
10691069
shift = 4;
10701070
while (c & 0x80) {
1071-
if (len <= used || bitsizeof(long) <= shift) {
1071+
if (len <= used || (bitsizeof(long) - 7) <= shift) {
10721072
error("bad object header");
10731073
size = used = 0;
10741074
break;

0 commit comments

Comments
 (0)