Commit 58074fe9 authored by mmoroz's avatar mmoroz Committed by Commit bot

port libxml_xml_read_memory_fuzzer (from kcc's libfuzzer-bot) and disable...

port libxml_xml_read_memory_fuzzer (from kcc's libfuzzer-bot) and disable error messages from the parser

R=aizatsky@chromium.org, inferno@chromium.org,kcc@chromium.org
TBR=krasin@chromium.org
BUG=569578

Review URL: https://codereview.chromium.org/1558483003

Cr-Commit-Position: refs/heads/master@{#367154}
parent fbec913f
......@@ -255,3 +255,12 @@ fuzzer_test("sqlite3_prepare_v2_fuzzer") {
"//third_party/sqlite",
]
}
fuzzer_test("libxml_xml_read_memory_fuzzer") {
sources = [
"libxml_xml_read_memory_fuzzer.cc",
]
deps = [
"//third_party/libxml:libxml",
]
}
// 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;
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment