From ef25896095244b9855f573937eabba8d64f5b5c4 Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Fri, 4 Apr 2025 08:16:59 -0700 Subject: [PATCH] Avoid overflow UB in random.cpp 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. --- src/tools/fuzzing/random.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tools/fuzzing/random.h b/src/tools/fuzzing/random.h index 21182c97e0b..664386939f2 100644 --- a/src/tools/fuzzing/random.h +++ b/src/tools/fuzzing/random.h @@ -35,7 +35,7 @@ class Random { bool finishedInput = false; // After we finish the input, we start going through it again, but xoring // so it's not identical. - int xorFactor = 0; + unsigned int xorFactor = 0; // Features used for picking among FeatureOptions. FeatureSet features;