From 1da5ad6a70bf2fc0697093c1cd96cb81c286f28c Mon Sep 17 00:00:00 2001 From: Roland Strasser Date: Wed, 10 Jan 2024 03:08:40 +0100 Subject: [PATCH 1/2] try fixing fuzzer build --- fuzz/fuzz-configuration-json.cpp | 5 ++++- fuzz/fuzz-parse-lint.cpp | 3 +-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/fuzz/fuzz-configuration-json.cpp b/fuzz/fuzz-configuration-json.cpp index a91fb12731..dd41342ecf 100644 --- a/fuzz/fuzz-configuration-json.cpp +++ b/fuzz/fuzz-configuration-json.cpp @@ -5,6 +5,7 @@ #include #include #include +#include #include #include @@ -14,7 +15,9 @@ int LLVMFuzzerTestOneInput(const std::uint8_t *data, std::size_t size) { Padded_String json(String8(reinterpret_cast(data), size)); Configuration c; - c.load_from_json(&json, &Null_Diag_Reporter::instance); + Monotonic_Allocator temp_memory("fuzz"); + Diag_List diags(&temp_memory); + c.load_from_json(&json, &diags); return 0; } diff --git a/fuzz/fuzz-parse-lint.cpp b/fuzz/fuzz-parse-lint.cpp index f95f794dd8..915aeecb02 100644 --- a/fuzz/fuzz-parse-lint.cpp +++ b/fuzz/fuzz-parse-lint.cpp @@ -13,10 +13,9 @@ extern "C" { int LLVMFuzzerTestOneInput(const std::uint8_t *data, std::size_t size) { quick_lint_js::Padded_String source(quick_lint_js::String8( reinterpret_cast(data), size)); - quick_lint_js::Global_Declared_Variable_Set globals; quick_lint_js::parse_and_lint(&source, quick_lint_js::Null_Diag_Reporter::instance, - globals, quick_lint_js::Linter_Options()); + quick_lint_js::Linter_Options()); return 0; } } From 380ce418cfd5fdeba5ae08b46d25da5de4b142b6 Mon Sep 17 00:00:00 2001 From: Roland Strasser Date: Wed, 10 Jan 2024 20:02:35 +0100 Subject: [PATCH 2/2] add config --- fuzz/fuzz-parse-lint.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/fuzz/fuzz-parse-lint.cpp b/fuzz/fuzz-parse-lint.cpp index 915aeecb02..3b961a7905 100644 --- a/fuzz/fuzz-parse-lint.cpp +++ b/fuzz/fuzz-parse-lint.cpp @@ -3,6 +3,7 @@ #include #include +#include #include #include #include @@ -13,9 +14,13 @@ extern "C" { int LLVMFuzzerTestOneInput(const std::uint8_t *data, std::size_t size) { quick_lint_js::Padded_String source(quick_lint_js::String8( reinterpret_cast(data), size)); + + quick_lint_js::Configuration config; quick_lint_js::parse_and_lint(&source, quick_lint_js::Null_Diag_Reporter::instance, - quick_lint_js::Linter_Options()); + quick_lint_js::Linter_Options{ + .configuration = &config, + }); return 0; } }