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

Dan Blackwell via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 8 05:49:31 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
----------------
DanBlackwell wrote:

```suggestion
  // Rounding can push the result above |max|, although never below |min|. Clamp
```

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


More information about the llvm-commits mailing list