Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(263)

Unified Diff: testing/libfuzzer/fuzzers/libxml_xml_read_memory_fuzzer.cc

Issue 1558483003: port libxml_xml_read_memory_fuzzer (from kcc's libfuzzer-bot) and disable error messages from the p… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « testing/libfuzzer/fuzzers/BUILD.gn ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: testing/libfuzzer/fuzzers/libxml_xml_read_memory_fuzzer.cc
diff --git a/testing/libfuzzer/fuzzers/libxml_xml_read_memory_fuzzer.cc b/testing/libfuzzer/fuzzers/libxml_xml_read_memory_fuzzer.cc
new file mode 100644
index 0000000000000000000000000000000000000000..392a9e3a2bc95c3e8ee872ae732dec8b18e1b76c
--- /dev/null
+++ b/testing/libfuzzer/fuzzers/libxml_xml_read_memory_fuzzer.cc
@@ -0,0 +1,20 @@
+// Copyright (c) 2015 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 "libxml/parser.h"
+
+void ignore (void * ctx, const char * msg, ...) {
+ // Error handler to avoid spam of error messages from libxml parser.
+}
+
+extern "C" int LLVMFuzzerTestOneInput(const unsigned char *data, size_t size) {
+ xmlSetGenericErrorFunc(NULL, &ignore);
+
+ if (auto doc = xmlReadMemory(reinterpret_cast<const char *>(data),
+ size, "noname.xml", NULL, 0)) {
+ xmlFreeDoc(doc);
+ }
+
+ return 0;
+}
« no previous file with comments | « testing/libfuzzer/fuzzers/BUILD.gn ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698