Coverage Report

Created: 2026-09-14 07:11

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libucl/tests/fuzzers/ucl_add_string_fuzzer.c
Line
Count
Source
1
#include <stdio.h>
2
#include <errno.h>
3
#include <unistd.h>
4
#include "ucl.h"
5
6
1.39k
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
1.39k
  if(size==0){
12
0
    return 0;
13
0
  }
14
1.39k
  struct ucl_parser *parser;
15
1.39k
        parser = ucl_parser_new(0);
16
  
17
1.39k
  ucl_parser_add_string(parser, (char *)data, size);
18
  
19
1.39k
  if (ucl_parser_get_error(parser) != NULL) {
20
1.33k
    return 0;
21
1.33k
  }
22
23
66
  ucl_parser_free (parser);
24
66
        return 0;
25
1.39k
}