summaryrefslogtreecommitdiff
path: root/tests/fuzz_xpath.cpp
blob: c7ff4cd0f46732830b07a05e1777246ac9ebc57b (plain)
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;
}