Coverage Report

Created: 2026-01-17 06:12

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
2.14k
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
2.14k
  if(size==0){
12
0
    return 0;
13
0
  }
14
2.14k
  struct ucl_parser *parser;
15
2.14k
        parser = ucl_parser_new(0);
16
  
17
2.14k
  ucl_parser_add_string(parser, (char *)data, size);
18
  
19
2.14k
  if (ucl_parser_get_error(parser) != NULL) {
20
1.95k
    return 0;
21
1.95k
  }
22
23
194
  ucl_parser_free (parser);
24
194
        return 0;
25
2.14k
}