blob: 6ab5e0bbf9fc3e4c9ac9965251b9e2b5aca6b53e [file] [log] [blame]
Juraj Vijtiuk260407e2020-03-18 10:32:13 +01001#include <stdio.h>
2#include <stdlib.h>
3#include <stdbool.h>
4
5#include "libyang.h"
6
7int LLVMFuzzerTestOneInput(uint8_t const *buf, size_t len)
8{
9 struct ly_ctx *ctx = NULL;
10 static bool log = false;
11 LY_ERR err;
12
13 if (!log) {
14 ly_log_options(0);
15 log = true;
16 }
17
18 err = ly_ctx_new(NULL, 0, &ctx);
19 if (err != LY_SUCCESS) {
20 fprintf(stderr, "Failed to create context\n");
21 exit(EXIT_FAILURE);
22 }
23
24 lys_parse_mem(ctx, buf, LYS_IN_YANG);
25 ly_ctx_destroy(ctx, NULL);
26 return 0;
27}