1 #include <stdio.h>
2 #include <errno.h>
3 #include <unistd.h>
4 #include "ucl.h"
5 
6 int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
7 	// If size is 0 we need a null-terminated string.
8 	// We dont null-terminate the string and by the design
9 	// of the API passing 0 as size with non null-terminated string
10 	// gives undefined behavior.
11 	if(size==0){
12 		return 0;
13 	}
14 	struct ucl_parser *parser;
15        	parser = ucl_parser_new(0);
16 
17 	ucl_parser_add_string(parser, (char *)data, size);
18 
19 	if (ucl_parser_get_error(parser) != NULL) {
20 		return 0;
21 	}
22 
23 	ucl_parser_free (parser);
24         return 0;
25 }
26