diff options
| author | Stefan Boberg <[email protected]> | 2026-04-23 18:16:57 +0200 |
|---|---|---|
| committer | Stefan Boberg <[email protected]> | 2026-04-23 18:16:57 +0200 |
| commit | 0232b991cd7d8e3a2114ea30e4591dd3e7b65c36 (patch) | |
| tree | 94730e7594fd09ae1fa820391ce311f6daf13905 /thirdparty/fmt/test/fuzzing/float.cc | |
| parent | Fix forward declaration order for s_GotSigWinch and SigWinchHandler (diff) | |
| parent | trace: declare Region event name fields as AnsiString (#1012) (diff) | |
| download | archived-zen-sb/zen-help.tar.xz archived-zen-sb/zen-help.zip | |
Merge branch 'main' into sb/zen-helpsb/zen-help
- Combine HelpCommand (this branch) with HistoryCommand (main) in zen CLI dispatcher
- Keep filter-aware TuiPickOne rewrite; adopt main's ASCII arrow glyphs in doc comment
Diffstat (limited to 'thirdparty/fmt/test/fuzzing/float.cc')
| -rw-r--r-- | thirdparty/fmt/test/fuzzing/float.cc | 39 |
1 files changed, 0 insertions, 39 deletions
diff --git a/thirdparty/fmt/test/fuzzing/float.cc b/thirdparty/fmt/test/fuzzing/float.cc deleted file mode 100644 index d4c9e4f57..000000000 --- a/thirdparty/fmt/test/fuzzing/float.cc +++ /dev/null @@ -1,39 +0,0 @@ -// A fuzzer for floating-point formatter. -// For the license information refer to format.h. - -#include <fmt/format.h> - -#include <cstdint> -#include <cstdlib> -#include <limits> -#include <stdexcept> - -#include "fuzzer-common.h" - -void check_round_trip(fmt::string_view format_str, double value) { - auto buffer = fmt::memory_buffer(); - fmt::format_to(std::back_inserter(buffer), format_str, value); - - if (std::isnan(value)) { - auto nan = std::signbit(value) ? "-nan" : "nan"; - if (fmt::string_view(buffer.data(), buffer.size()) != nan) - throw std::runtime_error("round trip failure"); - return; - } - - buffer.push_back('\0'); - char* ptr = nullptr; - if (std::strtod(buffer.data(), &ptr) != value) - throw std::runtime_error("round trip failure"); - if (ptr + 1 != buffer.end()) throw std::runtime_error("unparsed output"); -} - -extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { - if (size <= sizeof(double) || !std::numeric_limits<double>::is_iec559) - return 0; - check_round_trip("{}", assign_from_buf<double>(data)); - // A larger than necessary precision is used to trigger the fallback - // formatter. - check_round_trip("{:.50g}", assign_from_buf<double>(data)); - return 0; -} |