[compiler-rt] [libFuzzer] Clamp `ConsumeFloatingPointInRange` result to `max` (PR #221552)

Stan Ulbrych via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 8 07:17:06 PDT 2026


================
@@ -265,7 +265,13 @@ T FuzzedDataProvider::ConsumeFloatingPointInRange(T min, T max) {
     range = max - min;
   }
 
-  return result + range * ConsumeProbability<T>();
+  result += range * ConsumeProbability<T>();
+
+  // Rounding can push the resul above |max|, although never below |min|. Clamp
----------------
StanFromIreland wrote:

Aargh, thank you!

https://github.com/llvm/llvm-project/pull/221552


More information about the llvm-commits mailing list