aboutsummaryrefslogtreecommitdiff
path: root/contrib/libucl/tests/fuzzers/ucl_msgpack_fuzzer.c
blob: 6989ec0e4375218ec207e5494c14070a336c392e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include <stdio.h>
#include <errno.h>
#include <unistd.h>
#include "ucl.h"
#include "ucl_internal.h"
#include <ctype.h>

typedef ucl_object_t* (*ucl_msgpack_test)(void);


int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
	
	if(size<3){
		return 0;
	}

	struct ucl_parser *parser;
	
	ucl_object_t *obj = ucl_object_new_full (UCL_OBJECT, 2);
	obj->type = UCL_OBJECT;

	parser = ucl_parser_new(UCL_PARSER_KEY_LOWERCASE);
	parser->stack = NULL;

	bool res = ucl_parser_add_chunk_full(parser, (const unsigned char*)data, size, 0, UCL_DUPLICATE_APPEND, UCL_PARSE_MSGPACK);

	ucl_parser_free (parser);
	return 0;
}