Skip to content

Commit

Permalink
Merge pull request #14023 from hrydgard/ubsan-shift32-fix
Browse files Browse the repository at this point in the history
Attempt to fix #14022
  • Loading branch information
unknownbrackets authored Jan 30, 2021
2 parents 1eeebcc + 58f1905 commit d12d890
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Core/Font/PGF.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,10 @@ static int getBits(int numBits, const u8 *buf, size_t pos) {

const u8 done = 32 - bitoff;
const u8 remaining = numBits - done;
const u32 mask = (1 << remaining) - 1;
v |= (wordbuf[wordpos + 1] & mask) << done;
if (remaining > 0) {
const u32 mask = (1 << remaining) - 1;
v |= (wordbuf[wordpos + 1] & mask) << done;
}
return v;
}
}
Expand Down

0 comments on commit d12d890

Please sign in to comment.