[Libreoffice-commits] core.git: vcl/workben

Caolán McNamara caolanm at redhat.com
Wed Dec 7 13:41:59 UTC 2016


 vcl/workben/wmffuzzer.cxx |   21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

New commits:
commit b1955cced2e63710b67cd9d4f8392333dbfdf667
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Dec 7 13:40:53 2016 +0000

    oss-fuzz: provide a way to init fontconfig with minimal fonts
    
    Change-Id: Ic63788318d24fc01a38331a3567ccd67b1b8885f

diff --git a/vcl/workben/wmffuzzer.cxx b/vcl/workben/wmffuzzer.cxx
index ac834cc..ca9293e 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);
 


More information about the Libreoffice-commits mailing list