| 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;
|
| +}
|
|
|