Skip to content

Commit eb3b565

Browse files
DavidKorczynskiemanuele6
authored andcommitted
test: add jv_dump to extended fuzzer
Signed-off-by: David Korczynski <[email protected]>
1 parent 44300e4 commit eb3b565

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

tests/jq_fuzz_parse_extended.c

+7-1
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,16 @@
55
#include "jv.h"
66

77
int LLVMFuzzerTestOneInput(uint8_t *data, size_t size) {
8-
if (size < 4) {
8+
if (size < 8) {
99
return 0;
1010
}
1111

1212
int fuzz_flags = *(int*)data;
1313
data += 4;
1414
size -= 4;
15+
int dump_flags = *(int*)data;
16+
data += 4;
17+
size -= 4;
1518

1619
// Creat null-terminated string
1720
char *null_terminated = (char *)malloc(size + 1);
@@ -20,6 +23,9 @@ int LLVMFuzzerTestOneInput(uint8_t *data, size_t size) {
2023

2124
// Fuzzer entrypoint
2225
jv res = jv_parse_custom_flags(null_terminated, fuzz_flags);
26+
if (jv_is_valid(res)) {
27+
jv_dump(res, dump_flags);
28+
}
2329
jv_free(res);
2430

2531
// Free the null-terminated string

0 commit comments

Comments
 (0)