diff options
author | MarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz> | 2023-07-17 09:51:22 +0200 |
---|---|---|
committer | MarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz> | 2023-07-17 09:39:52 +0200 |
commit | fa367422efa3c00f27dab2b58f2080303ed18b91 (patch) | |
tree | 2c008c98d2fdd18bf80558e42917cb81c9e5dcdc /src/test/fuzz | |
parent | 01e5d6b105861ebf1216df6f1682004e44dd2544 (diff) |
fuzz: Bump FuzzedDataProvider.h
From https://github.com/llvm/llvm-project/blob/fa8401f9bfe81f4853bf9b67bff42a2cebffc10f/compiler-rt/include/fuzzer/FuzzedDataProvider.h
Diffstat (limited to 'src/test/fuzz')
-rw-r--r-- | src/test/fuzz/FuzzedDataProvider.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/test/fuzz/FuzzedDataProvider.h b/src/test/fuzz/FuzzedDataProvider.h index 6cbfc39bc2..8a8214bd99 100644 --- a/src/test/fuzz/FuzzedDataProvider.h +++ b/src/test/fuzz/FuzzedDataProvider.h @@ -209,7 +209,7 @@ T FuzzedDataProvider::ConsumeIntegralInRange(T min, T max) { abort(); // Use the biggest type possible to hold the range and the result. - uint64_t range = static_cast<uint64_t>(max) - min; + uint64_t range = static_cast<uint64_t>(max) - static_cast<uint64_t>(min); uint64_t result = 0; size_t offset = 0; @@ -230,7 +230,7 @@ T FuzzedDataProvider::ConsumeIntegralInRange(T min, T max) { if (range != std::numeric_limits<decltype(range)>::max()) result = result % (range + 1); - return static_cast<T>(min + result); + return static_cast<T>(static_cast<uint64_t>(min) + result); } // Returns a floating point value in the range [Type's lowest, Type's max] by @@ -390,7 +390,7 @@ TS FuzzedDataProvider::ConvertUnsignedToSigned(TU value) { return static_cast<TS>(value); } else { constexpr auto TS_min = std::numeric_limits<TS>::min(); - return TS_min + static_cast<char>(value - TS_min); + return TS_min + static_cast<TS>(value - TS_min); } } |