[scudo/standalone] Fix undefined behavior in checksum test

1U has type unsigned int, and << of 32 or more is undefined behavior.
Use the proper type in the lhs of the shift.

Reviewed By: cryptoad

Differential Revision: https://reviews.llvm.org/D87973
This commit is contained in:
Roland McGrath 2020-09-19 11:44:39 -07:00
parent a2f9098f7a
commit f5fa5b9fe3
1 changed files with 2 additions and 2 deletions

View File

@ -41,10 +41,10 @@ template <ComputeChecksum F> void verifyChecksumFunctionBitFlip() {
scudo::u8 IdenticalChecksums = 0;
for (scudo::uptr I = 0; I < ArraySize; I++) {
for (scudo::uptr J = 0; J < SCUDO_WORDSIZE; J++) {
Array[I] ^= 1U << J;
Array[I] ^= scudo::uptr{1} << J;
if (F(Seed, Array, ArraySize) == Reference)
IdenticalChecksums++;
Array[I] ^= 1U << J;
Array[I] ^= scudo::uptr{1} << J;
}
}
// Allow for a couple of identical checksums over the whole set of flips.