Skip to content

Commit fa36742

Browse files
author
MarcoFalke
committed

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

src/test/fuzz/FuzzedDataProvider.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ T FuzzedDataProvider::ConsumeIntegralInRange(T min, T max) {
209209
abort();
210210

211211
// Use the biggest type possible to hold the range and the result.
212-
uint64_t range = static_cast<uint64_t>(max) - min;
212+
uint64_t range = static_cast<uint64_t>(max) - static_cast<uint64_t>(min);
213213
uint64_t result = 0;
214214
size_t offset = 0;
215215

@@ -230,7 +230,7 @@ T FuzzedDataProvider::ConsumeIntegralInRange(T min, T max) {
230230
if (range != std::numeric_limits<decltype(range)>::max())
231231
result = result % (range + 1);
232232

233-
return static_cast<T>(min + result);
233+
return static_cast<T>(static_cast<uint64_t>(min) + result);
234234
}
235235

236236
// Returns a floating point value in the range [Type's lowest, Type's max] by
@@ -390,7 +390,7 @@ TS FuzzedDataProvider::ConvertUnsignedToSigned(TU value) {
390390
return static_cast<TS>(value);
391391
} else {
392392
constexpr auto TS_min = std::numeric_limits<TS>::min();
393-
return TS_min + static_cast<char>(value - TS_min);
393+
return TS_min + static_cast<TS>(value - TS_min);
394394
}
395395
}
396396

test/sanitizer_suppressions/ubsan

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ implicit-integer-sign-change:*/include/boost/
2020
implicit-integer-sign-change:*/include/c++/
2121
implicit-integer-sign-change:*/new_allocator.h
2222
implicit-integer-sign-change:crc32c/
23-
# implicit-integer-sign-change in FuzzedDataProvider's ConsumeIntegralInRange
24-
implicit-integer-sign-change:FuzzedDataProvider.h
2523
implicit-integer-sign-change:minisketch/
2624
implicit-signed-integer-truncation:*/include/c++/
2725
implicit-signed-integer-truncation:leveldb/

0 commit comments

Comments
 (0)