vcl/workben/fodt2pdffuzzer.cxx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
New commits: commit 12b9c296d9a233b1c02a356225354c056ff78b54 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Thu May 11 21:11:21 2023 +0100 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Thu May 11 22:16:37 2023 +0200 move xmlSetGenericErrorFunc into LLVMFuzzerInitialize and add xmlInitParser there Change-Id: Ifde0f8d9e8be413fd3dcf216ad33effa731fa549 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151684 Tested-by: Caolán McNamara <caol...@redhat.com> Reviewed-by: Caolán McNamara <caol...@redhat.com> diff --git a/vcl/workben/fodt2pdffuzzer.cxx b/vcl/workben/fodt2pdffuzzer.cxx index 6d255cd2564a..0b6323a61ad8 100644 --- a/vcl/workben/fodt2pdffuzzer.cxx +++ b/vcl/workben/fodt2pdffuzzer.cxx @@ -19,6 +19,8 @@ extern "C" void* SwCreateDialogFactory() { return nullptr; } extern "C" bool TestPDFExportFODT(SvStream& rStream); +static void silent_error_func(void*, const char* /*format*/, ...) {} + extern "C" int LLVMFuzzerInitialize(int* argc, char*** argv) { if (__lsan_disable) @@ -47,13 +49,14 @@ extern "C" int LLVMFuzzerInitialize(int* argc, char*** argv) if (__lsan_enable) __lsan_enable(); + xmlInitParser(); + xmlSetGenericErrorFunc(nullptr, silent_error_func); + return 0; } extern "C" size_t LLVMFuzzerMutate(uint8_t* Data, size_t Size, size_t MaxSize); -static void silent_error_func(void*, const char* /*format*/, ...) {} - extern "C" size_t LLVMFuzzerCustomMutator(uint8_t* Data, size_t Size, size_t MaxSize, unsigned int /*Seed*/) { @@ -64,7 +67,6 @@ extern "C" size_t LLVMFuzzerCustomMutator(uint8_t* Data, size_t Size, size_t Max // pdf export xmlParserCtxtPtr ctxt = xmlNewParserCtxt(); - xmlSetGenericErrorFunc(nullptr, silent_error_func); xmlDocPtr Doc = xmlCtxtReadMemory(ctxt, reinterpret_cast<const char*>(Data), Ret, nullptr, nullptr, XML_PARSE_NONET); if (Doc == nullptr)