forked from OSchip/llvm-project
Fix some undefined behavior (excessive shift of signed value) in r364253 detected by ubsan
llvm-svn: 364461
This commit is contained in:
parent
806600987d
commit
730a95c88a
|
@ -176,7 +176,7 @@ inline int64_t decodeSLEB128(const uint8_t *p, unsigned *n = nullptr,
|
|||
return 0;
|
||||
}
|
||||
Byte = *p++;
|
||||
Value |= (int64_t(Byte & 0x7f) << Shift);
|
||||
Value |= (uint64_t(Byte & 0x7f) << Shift);
|
||||
Shift += 7;
|
||||
} while (Byte >= 128);
|
||||
// Sign extend negative numbers if needed.
|
||||
|
|
Loading…
Reference in New Issue