Coverage Report

Created: 2026-03-12 06:35

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/CMake/Tests/Fuzzing/xml_parser_fuzzer.cc
Line
Count
Source
1
/* Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
2
   file LICENSE.rst or https://cmake.org/licensing for details.  */
3
4
#include <stdint.h>
5
#include <stdio.h>
6
#include <stdlib.h>
7
8
#include "cmXMLParser.h"
9
10
extern "C" int LLVMFuzzerTestOneInput(uint8_t const* data, size_t size)
11
9.28k
{
12
9.28k
  char test_file[] = "libfuzzer.xml";
13
14
9.28k
  FILE* fp = fopen(test_file, "wb");
15
9.28k
  if (!fp)
16
0
    return 0;
17
9.28k
  fwrite(data, size, 1, fp);
18
9.28k
  fclose(fp);
19
20
9.28k
  cmXMLParser parser;
21
9.28k
  if (!parser.ParseFile(test_file)) {
22
6.66k
    return 1;
23
6.66k
  }
24
25
2.62k
  remove(test_file);
26
2.62k
  return 0;
27
9.28k
}