From 4e2126fd741c1b04b4d887f950c70783957bc135 Mon Sep 17 00:00:00 2001 From: DavidKorczynski Date: Sun, 3 Dec 2023 16:12:20 +0000 Subject: [PATCH] jq_fuzz_execute.cpp: fix false assert Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=64632 by following the suggestion here: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=64632#c2 -- the issue is fixed when this attribute is set. I did not add any of the other suggestions in the comment: we haven't run into these issues in the fuzzer so far. --- tests/jq_fuzz_execute.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/jq_fuzz_execute.cpp b/tests/jq_fuzz_execute.cpp index 66a044f380..fe95a6a988 100644 --- a/tests/jq_fuzz_execute.cpp +++ b/tests/jq_fuzz_execute.cpp @@ -16,6 +16,10 @@ extern "C" int LLVMFuzzerTestOneInput(uint8_t *data, size_t size) { jq_state *jq = NULL; jq = jq_init(); if (jq != NULL) { + char *origin = strdup("/tmp/"); + jq_set_attr(jq, jv_string("JQ_ORIGIN"), jv_string(origin)); + free(origin); + if (jq_compile(jq, prog_payload.c_str())) { // Process to jv_parse and then jv_next jv input = jv_parse(parse_payload1.c_str());