Skip to content

Commit

Permalink
jq_fuzz_execute.cpp: fix false assert
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
DavidKorczynski authored Dec 3, 2023
1 parent 693a726 commit 4e2126f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tests/jq_fuzz_execute.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down

0 comments on commit 4e2126f

Please sign in to comment.