jq_fuzz_compile.c
This file
Path
tests/jq_fuzz_compile.c
27 lines · 570 bytes · C
Last changed by
Not known.
History of this fileTake it
1#include <stdint.h>2#include <stdlib.h>3#include <string.h>45#include "jq.h"67int LLVMFuzzerTestOneInput(uint8_t *data, size_t size) {8 // Creat null-terminated string9 char *null_terminated = (char *)malloc(size + 1);10 memcpy(null_terminated, (char *)data, size);11 null_terminated[size] = '\0';1213 // Fuzzer entrypoint14 jq_state *jq = NULL;15 jq = jq_init();16 if (jq != NULL) {17 if (jq_compile(jq, null_terminated)) {18 jq_dump_disassembly(jq, 2);19 }20 }21 jq_teardown(&jq);2223 // Free the null-terminated string24 free(null_terminated);2526 return 0;27}