1
0
mirror of https://github.com/stedolan/jq.git synced 2024-05-11 05:55:39 +00:00
stedolan-jq/tests/jq_fuzz_parse.c
davkor 3df8f90c4e Add first fuzzer for integration with OSS-Fuzz.
Signed-off-by: David Korczynski <david@adalogics.com>
2023-07-10 13:57:38 -05:00

22 lines
456 B
C

#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include "jv.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
jv res = jv_parse(null_terminated);
jv_free(res);
// Free the null-terminated string
free(null_terminated);
return 0;
}