diff options
Diffstat (limited to 'test/fuzzing/chrono-duration.cc')
-rw-r--r-- | test/fuzzing/chrono-duration.cc | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/test/fuzzing/chrono-duration.cc b/test/fuzzing/chrono-duration.cc index fdad9894..d66068d9 100644 --- a/test/fuzzing/chrono-duration.cc +++ b/test/fuzzing/chrono-duration.cc @@ -1,9 +1,10 @@ // Copyright (c) 2019, Paul Dreik // For the license information refer to format.h. -#include <cstdint> #include <fmt/chrono.h> +#include <cstdint> + #include "fuzzer-common.h" template <typename Period, typename Rep> @@ -13,8 +14,8 @@ void invoke_inner(fmt::string_view format_str, Rep rep) { #if FMT_FUZZ_FORMAT_TO_STRING std::string message = fmt::format(format_str, value); #else - fmt::memory_buffer buf; - fmt::format_to(buf, format_str, value); + auto buf = fmt::memory_buffer(); + fmt::format_to(std::back_inserter(buf), format_str, value); #endif } catch (std::exception&) { } @@ -31,7 +32,7 @@ void invoke_outer(const uint8_t* data, size_t size, int period) { data += fixed_size; size -= fixed_size; - // data is already allocated separately in libFuzzer so reading past the end + // data is already allocated separately in libFuzzer so reading past the end // will most likely be detected anyway. const auto format_str = fmt::string_view(as_chars(data), size); @@ -86,7 +87,7 @@ void invoke_outer(const uint8_t* data, size_t size, int period) { } extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { - if (size <= 4) return 0; + if (size <= 4) return 0; const auto representation = data[0]; const auto period = data[1]; |