mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-22 01:11:42 +00:00
[wpiutil] Fix bug in uleb128 (#3540)
Caused by UB in left shift; identified by ubsan.
This commit is contained in:
@@ -45,7 +45,7 @@ uint64_t ReadUleb128(const char* addr, uint64_t* ret) {
|
||||
addr++;
|
||||
count++;
|
||||
|
||||
result |= (byte & 0x7f) << shift;
|
||||
result |= (byte & 0x7fULL) << shift;
|
||||
shift += 7;
|
||||
|
||||
if (!(byte & 0x80)) {
|
||||
@@ -69,7 +69,7 @@ bool ReadUleb128(raw_istream& is, uint64_t* ret) {
|
||||
return false;
|
||||
}
|
||||
|
||||
result |= (byte & 0x7f) << shift;
|
||||
result |= (byte & 0x7fULL) << shift;
|
||||
shift += 7;
|
||||
|
||||
if (!(byte & 0x80)) {
|
||||
|
||||
Reference in New Issue
Block a user