Coverage Report

Created: 2026-01-10 06:34

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
7.27k
{
12
7.27k
  char test_file[] = "libfuzzer.xml";
13
14
7.27k
  FILE* fp = fopen(test_file, "wb");
15
7.27k
  if (!fp)
16
0
    return 0;
17
7.27k
  fwrite(data, size, 1, fp);
18
7.27k
  fclose(fp);
19
20
7.27k
  cmXMLParser parser;
21
7.27k
  if (!parser.ParseFile(test_file)) {
22
4.52k
    return 1;
23
4.52k
  }
24
25
2.74k
  remove(test_file);
26
2.74k
  return 0;
27
7.27k
}