Skip to content

Commit 62b55de

Browse files
authored
Avoid overflow UB in random.cpp (#7449)
The random number generator adds into `xorFactor` in various places. This variable was previously signed, so overflows from these adds were UB. Make it unsigned to avoid UB.
1 parent 5dd2d41 commit 62b55de

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/tools/fuzzing/random.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class Random {
3535
bool finishedInput = false;
3636
// After we finish the input, we start going through it again, but xoring
3737
// so it's not identical.
38-
int xorFactor = 0;
38+
unsigned int xorFactor = 0;
3939
// Features used for picking among FeatureOptions.
4040
FeatureSet features;
4141

0 commit comments

Comments
 (0)