Skip to content
Myr

jq_fuzz_parse.c

This file

Path

tests/jq_fuzz_parse.c

21 lines · 456 bytes · C

Last changed by

Not known.

History of this file

Take it

1#include <stdint.h>2#include <stdlib.h>3#include <string.h>45#include "jv.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  jv res = jv_parse(null_terminated);15  jv_free(res);1617  // Free the null-terminated string18  free(null_terminated);1920  return 0;21}