xref: /freebsd/contrib/libucl/tests/fuzzers/ucl_msgpack_fuzzer.c (revision ebacd8013fe5f7fdf9f6a5b286f6680dd2891036)
1 #include <stdio.h>
2 #include <errno.h>
3 #include <unistd.h>
4 #include "ucl.h"
5 #include "ucl_internal.h"
6 #include <ctype.h>
7 
8 typedef ucl_object_t* (*ucl_msgpack_test)(void);
9 
10 
11 int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
12 
13 	if(size<3){
14 		return 0;
15 	}
16 
17 	struct ucl_parser *parser;
18 
19 	ucl_object_t *obj = ucl_object_new_full (UCL_OBJECT, 2);
20 	obj->type = UCL_OBJECT;
21 
22 	parser = ucl_parser_new(UCL_PARSER_KEY_LOWERCASE);
23 	parser->stack = NULL;
24 
25 	bool res = ucl_parser_add_chunk_full(parser, (const unsigned char*)data, size, 0, UCL_DUPLICATE_APPEND, UCL_PARSE_MSGPACK);
26 
27 	ucl_parser_free (parser);
28 	return 0;
29 }
30