vcl/unx/generic/gdi/cairotextrender.cxx | 18 ++++++++++++++++++ vcl/workben/svmfuzzer.cxx | 5 ----- 2 files changed, 18 insertions(+), 5 deletions(-)
New commits: commit 163e4686914ecf04f1cbef2f6a087cadbfe59f81 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Sat May 14 19:40:50 2022 +0100 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Sat May 14 22:55:47 2022 +0200 ofz#47323 suppress Direct-leak __lsan_default_suppressions works in a local oss-fuzz image but seems to have no effect when deployed which fits with the report of https://github.com/google/oss-fuzz/issues/6066 try explicit __lsan_disable/__lsan_enable guards which also works locally Change-Id: Ifbfdb9d9ba7014b78b43578c25fca97c3279bc5d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134331 Tested-by: Caolán McNamara <caol...@redhat.com> Reviewed-by: Caolán McNamara <caol...@redhat.com> diff --git a/vcl/unx/generic/gdi/cairotextrender.cxx b/vcl/unx/generic/gdi/cairotextrender.cxx index 31c2a73c2eb4..0be33e9436c9 100644 --- a/vcl/unx/generic/gdi/cairotextrender.cxx +++ b/vcl/unx/generic/gdi/cairotextrender.cxx @@ -117,6 +117,14 @@ namespace } } +#if defined(FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION) +extern "C" +{ + __attribute__((weak)) void __lsan_disable(); + __attribute__((weak)) void __lsan_enable(); +} +#endif + void CairoTextRender::DrawTextLayout(const GenericSalLayout& rLayout, const SalGraphics& rGraphics) { const FreetypeFontInstance& rInstance = static_cast<FreetypeFontInstance&>(rLayout.GetFont()); @@ -178,6 +186,11 @@ void CairoTextRender::DrawTextLayout(const GenericSalLayout& rLayout, const SalG return; } +#if defined(FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION) + if (__lsan_disable) + __lsan_disable(); +#endif + if (const cairo_font_options_t* pFontOptions = GetSalInstance()->GetCairoFontOptions()) { const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); @@ -305,6 +318,11 @@ void CairoTextRender::DrawTextLayout(const GenericSalLayout& rLayout, const SalG } releaseCairoContext(cr); + +#if defined(FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION) + if (__lsan_enable) + __lsan_enable(); +#endif } void FontConfigFontOptions::cairo_font_options_substitute(FcPattern* pPattern) diff --git a/vcl/workben/svmfuzzer.cxx b/vcl/workben/svmfuzzer.cxx index f0c129e76cd4..53757e3199c7 100644 --- a/vcl/workben/svmfuzzer.cxx +++ b/vcl/workben/svmfuzzer.cxx @@ -73,11 +73,6 @@ extern "C" int LLVMFuzzerInitialize(int *argc, char ***argv) return 0; } -extern "C" const char* __lsan_default_suppressions() -{ - return "leak:CairoTextRender::DrawTextLayout\n"; -} - extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { SvMemoryStream aStream(const_cast<uint8_t*>(data), size, StreamMode::READ);