File: fuzz_xpath.cpp

package info (click to toggle)
pugixml 1.14-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 4,052 kB
  • sloc: cpp: 24,068; xml: 2,151; makefile: 80; python: 44; sh: 9
file content (26 lines) | stat: -rw-r--r-- 403 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include "../src/pugixml.hpp"

#include <stdint.h>
#include <string.h>

extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size)
{
	char* text = new char[Size + 1];
	memcpy(text, Data, Size);
	text[Size] = 0;

#ifdef PUGIXML_NO_EXCEPTIONS
	pugi::xpath_query q(text);
#else
	try
	{
		pugi::xpath_query q(text);
	}
	catch (pugi::xpath_exception&)
	{
	}
#endif

	delete[] text;
	return 0;
}