Coverage Report

Created: 2025-11-03 06:51

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/hostap/tests/fuzzing/json/json.c
Line
Count
Source
1
/*
2
 * JSON parser - test program
3
 * Copyright (c) 2019, Jouni Malinen <j@w1.fi>
4
 *
5
 * This software may be distributed under the terms of the BSD license.
6
 * See README for more details.
7
 */
8
9
#include "utils/includes.h"
10
#include "utils/common.h"
11
#include "utils/json.h"
12
#include "../fuzzer-common.h"
13
14
15
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
16
1.03k
{
17
1.03k
  struct json_token *root;
18
1.03k
  char *txt;
19
1.03k
  size_t buflen = 10000;
20
21
1.03k
  wpa_fuzzer_set_debug_level();
22
23
1.03k
  root = json_parse((const char *) data, size);
24
1.03k
  if (!root) {
25
900
    wpa_printf(MSG_DEBUG, "JSON parsing failed");
26
900
    return 0;
27
900
  }
28
29
134
  txt = os_zalloc(buflen);
30
134
  if (txt) {
31
134
    json_print_tree(root, txt, buflen);
32
134
    wpa_printf(MSG_DEBUG, "%s", txt);
33
134
    os_free(txt);
34
134
  }
35
134
  json_free(root);
36
37
134
  return 0;
38
1.03k
}