Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tries to fix the fuzzer build #1179

Merged
merged 2 commits into from
Jan 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion fuzz/fuzz-configuration-json.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <cstdint>
#include <quick-lint-js/configuration/configuration.h>
#include <quick-lint-js/container/padded-string.h>
#include <quick-lint-js/diag/diag-list.h>
#include <quick-lint-js/diag/diag-reporter.h>
#include <quick-lint-js/port/char8.h>

Expand All @@ -14,7 +15,9 @@ int LLVMFuzzerTestOneInput(const std::uint8_t *data, std::size_t size) {

Padded_String json(String8(reinterpret_cast<const Char8 *>(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;
}
Expand Down
8 changes: 6 additions & 2 deletions fuzz/fuzz-parse-lint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#include <cstddef>
#include <cstdint>
#include <quick-lint-js/configuration/configuration.h>
#include <quick-lint-js/container/padded-string.h>
#include <quick-lint-js/diag/diag-reporter.h>
#include <quick-lint-js/fe/global-declared-variable-set.h>
Expand All @@ -13,10 +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<const quick_lint_js::Char8 *>(data), size));
quick_lint_js::Global_Declared_Variable_Set globals;

quick_lint_js::Configuration config;
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{
.configuration = &config,
});
return 0;
}
}
Expand Down
Loading