CMake/Tests/Fuzzing/xml_parser_fuzzer.cc
Kitware Robot de273b2e11 LICENSE: Replace references to Copyright.txt with LICENSE.rst
```
git grep -lz 'Copyright.txt or https://cmake.org/licensing ' |
  while IFS= read -r -d $'\0' f ; do
    sed -i '/Copyright.txt or https:\/\/cmake.org\/licensing / {
              s/Copyright.txt/LICENSE.rst/
            }' "$f" ; done
```
2025-03-03 09:56:07 -05:00

28 lines
566 B
C++

/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file LICENSE.rst or https://cmake.org/licensing for details. */
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include "cmXMLParser.h"
extern "C" int LLVMFuzzerTestOneInput(uint8_t const* data, size_t size)
{
char test_file[] = "libfuzzer.xml";
FILE* fp = fopen(test_file, "wb");
if (!fp)
return 0;
fwrite(data, size, 1, fp);
fclose(fp);
cmXMLParser parser;
if (!parser.ParseFile(test_file)) {
return 1;
}
remove(test_file);
return 0;
}