Fixed overflow check

This commit is contained in:
SChernykh 2024-05-09 21:55:30 +02:00
parent f270b979c8
commit e07d37ede8

View file

@ -168,7 +168,7 @@ const uint8_t* readVarint(const uint8_t* data, const uint8_t* data_end, T& b)
const uint64_t cur_byte = *(data++);
result |= (cur_byte & 0x7F) << k;
if (shiftleft128(cur_byte & 0x7F, 0, k) != 0) {
if ((k > 0) && (shiftleft128(cur_byte & 0x7F, 0, k) != 0)) {
return nullptr;
}