forked from OSchip/llvm-project
[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:
parent
a2f9098f7a
commit
f5fa5b9fe3
|
@ -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.
|
||||
|
|
Loading…
Reference in New Issue