aboutsummaryrefslogtreecommitdiffhomepage
path: root/projects/expat/parse_fuzzer.cc
diff options
context:
space:
mode:
Diffstat (limited to 'projects/expat/parse_fuzzer.cc')
-rw-r--r--projects/expat/parse_fuzzer.cc47
1 files changed, 0 insertions, 47 deletions
diff --git a/projects/expat/parse_fuzzer.cc b/projects/expat/parse_fuzzer.cc
deleted file mode 100644
index ff4cccd0..00000000
--- a/projects/expat/parse_fuzzer.cc
+++ /dev/null
@@ -1,47 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include <stddef.h>
-#include <stdint.h>
-
-#include "expat.h"
-
-#include <functional>
-#include <string>
-
-const char* kEncoding =
-#if defined(ENCODING_UTF_16)
-"UTF-16"
-#elif defined(ENCODING_UTF_8)
-"UTF-8"
-#elif defined(ENCODING_ISO_8859_1)
-"ISO-8859-1"
-#elif defined(ENCODING_US_ASCII)
-"US-ASCII"
-#elif defined(ENCODING_UTF_16BE)
-"UTF-16BE"
-#elif defined(ENCODING_UTF_16LE)
-"UTF-16LE"
-#else
-#error Encoding type is not specified.
-#endif
-;
-
-// Entry point for LibFuzzer.
-extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
- std::string input(reinterpret_cast<const char*>(data), size);
- auto hash_salt = std::hash<std::string>()(input);
-
- for (int use_ns = 0; use_ns <= 1; ++use_ns) {
- XML_Parser parser =
- use_ns ? XML_ParserCreateNS(kEncoding, '\n') :
- XML_ParserCreate(kEncoding);
-
- // Set a hash salt to prevent MSan from crashing on random bytes generation.
- XML_SetHashSalt(parser, hash_salt);
- XML_Parse(parser, input.c_str(), input.size(), true);
- XML_ParserFree(parser);
- }
- return 0;
-}