File: jq_fuzz_parse.c

package info (click to toggle)
jq 1.8.1-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,852 kB
  • sloc: ansic: 28,064; yacc: 888; sh: 841; python: 316; cpp: 314; lex: 192; makefile: 181; javascript: 34
file content (21 lines) | stat: -rw-r--r-- 456 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#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;
}