diff options
author | Caolán McNamara <caolanm@redhat.com> | 2023-05-11 21:11:21 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2023-05-11 22:16:37 +0200 |
commit | 12b9c296d9a233b1c02a356225354c056ff78b54 (patch) | |
tree | a123767edec26c734ecc0e2f63e70cbc8441f87d /vcl/workben/fodt2pdffuzzer.cxx | |
parent | 279b21da6a4586915f889a4a835b252dae64b758 (diff) |
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 <caolanm@redhat.com>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl/workben/fodt2pdffuzzer.cxx')
-rw-r--r-- | vcl/workben/fodt2pdffuzzer.cxx | 8 |
1 files changed, 5 insertions, 3 deletions
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) |