Skip to content
Myr

Add first fuzzer for integration with OSS-Fuzz.

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by davkor · committed by Nico Williams · parent 6ca7973 · Browse files · 1 file+21 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Trailers

  • Signed-off-by: David Korczynski <david@adalogics.com>

Diff stats

1 file+21 added−0 removed

  • tests:+21 added−0 removed

1 file+21 added−0 removed

added:tests/jq_fuzz_parse.c+21 added
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}