Browse Source

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
maint
Junio C Hamano 3 years ago
parent
commit
2d5b70de2d
  1. 2
      packfile.c

2
packfile.c

@ -1068,7 +1068,7 @@ unsigned long unpack_object_header_buffer(const unsigned char *buf, @@ -1068,7 +1068,7 @@ unsigned long unpack_object_header_buffer(const unsigned char *buf,
size = c & 15;
shift = 4;
while (c & 0x80) {
if (len <= used || bitsizeof(long) <= shift) {
if (len <= used || (bitsizeof(long) - 7) <= shift) {
error("bad object header");
size = used = 0;
break;

Loading…
Cancel
Save