Coverage Report

Created: 2025-11-24 06:25

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