mirror of
https://github.com/stedolan/jq.git
synced 2024-05-11 05:55:39 +00:00
26 lines
524 B
C
26 lines
524 B
C
#include <stdint.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
|
|
#include "jq.h"
|
|
|
|
int LLVMFuzzerTestOneInput(uint8_t *data, size_t size) {
|
|
// Creat null-terminated string
|
|
char *null_terminated = (char *)malloc(size + 1);
|
|
memcpy(null_terminated, (char *)data, size);
|
|
null_terminated[size] = '\0';
|
|
|
|
// Fuzzer entrypoint
|
|
jq_state *jq = NULL;
|
|
jq = jq_init();
|
|
if (jq != NULL) {
|
|
jq_compile(jq, null_terminated);
|
|
}
|
|
jq_teardown(&jq);
|
|
|
|
// Free the null-terminated string
|
|
free(null_terminated);
|
|
|
|
return 0;
|
|
}
|