Fix too large shifting in uleb128

This commit is contained in:
pancake 2022-05-09 16:29:05 +02:00 committed by pancake
parent c98d15e084
commit 318b45ba6b

View File

@ -158,11 +158,13 @@ R_API st64 r_sleb128(const ut8 **data, const ut8 *end) {
st64 chunk;
value = *p;
chunk = value & 0x7f;
if (offset < 64) {
result |= (chunk << offset);
}
offset += 7;
} while (cond = *p & 0x80 && p + 1 < end, p++, cond);
if ((value & 0x40) != 0) {
if ((value & 0x40) != 0 && offset < 64) {
result |= ~0ULL << offset;
}
*data = p;