diff options
Diffstat (limited to 'compiler-rt/include/fuzzer/FuzzedDataProvider.h')
| -rw-r--r-- | compiler-rt/include/fuzzer/FuzzedDataProvider.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/compiler-rt/include/fuzzer/FuzzedDataProvider.h b/compiler-rt/include/fuzzer/FuzzedDataProvider.h index fd895b767d9e..3e069eba69b4 100644 --- a/compiler-rt/include/fuzzer/FuzzedDataProvider.h +++ b/compiler-rt/include/fuzzer/FuzzedDataProvider.h @@ -263,6 +263,12 @@ class FuzzedDataProvider { // which seems to be a natural choice for other implementations as well. // To increase the odds even more, we also call |shrink_to_fit| below. std::vector<T> result(size); + if (size == 0) { + if (num_bytes_to_consume != 0) + abort(); + return result; + } + std::memcpy(result.data(), data_ptr_, num_bytes_to_consume); Advance(num_bytes_to_consume); |
