diff options
-rw-r--r-- | vcl/workben/wmffuzzer.cxx | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/vcl/workben/wmffuzzer.cxx b/vcl/workben/wmffuzzer.cxx index ac834cc61401..ca9293e50db0 100644 --- a/vcl/workben/wmffuzzer.cxx +++ b/vcl/workben/wmffuzzer.cxx @@ -16,6 +16,7 @@ #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/uno/XComponentContext.hpp> #include <unotools/configmgr.hxx> +#include <osl/file.hxx> #include <vcl/svapp.hxx> #include <vcl/wmf.hxx> #include <unistd.h> @@ -25,9 +26,29 @@ using namespace ::com::sun::star::uno; using namespace ::com::sun::star::lang; using namespace cppu; +namespace +{ + void setFontConfigConf() + { + OUString uri; + if (osl_getExecutableFile(&uri.pData) != osl_Process_E_None) { + abort(); + } + sal_Int32 lastDirSeperatorPos = uri.lastIndexOf('/'); + if (lastDirSeperatorPos >= 0) { + uri = uri.copy(0, lastDirSeperatorPos + 1); + } + OUString path; + osl::FileBase::getSystemPathFromFileURL(uri, path); + OString sFontConf = OUStringToOString(path, osl_getThreadTextEncoding()) + "fonts.conf"; + setenv("FONTCONFIG_FILE", sFontConf.getStr(), 0); + } +} + extern "C" int LLVMFuzzerInitialize(int *argc, char ***argv) { setenv("SAL_USE_VCLPLUGIN", "svp", 1); + setFontConfigConf(); osl_setCommandArgs(*argc, *argv); |