cppuhelper/source/servicemanager.cxx |    9 ++++++++-
 unoidl/Library_unoidl.mk             |    8 +++++++-
 unoidl/source/unoidl.cxx             |    9 +++++++++
 vcl/commonfuzzer.mk                  |    2 --
 4 files changed, 24 insertions(+), 4 deletions(-)

New commits:
commit ca1c8b447110321664a7a385dda5af6e303a91c8
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Tue Feb 13 14:59:48 2024 +0000
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Tue Feb 13 17:27:34 2024 +0100

    we don't need the reg or store libraries for fuzzing
    
    possibly other configations too, but just for fuzzing for the moment
    
    from looking at:
    https://oss-fuzz.com/coverage-report/job/libfuzzer_asan_libreoffice/latest
    and see what is built but is 0% coverage and uninteresting to be non-0
    
    Change-Id: Ia7afdfc033dd8a705d85c76b246dc5dfb259b063
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163311
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>

diff --git a/cppuhelper/source/servicemanager.cxx 
b/cppuhelper/source/servicemanager.cxx
index cd981b8d1a87..1e9c2dbbc192 100644
--- a/cppuhelper/source/servicemanager.cxx
+++ b/cppuhelper/source/servicemanager.cxx
@@ -17,6 +17,8 @@
 #include <utility>
 #include <vector>
 
+#include <config_fuzzers.h>
+
 #include <com/sun/star/beans/NamedValue.hpp>
 #include <com/sun/star/beans/PropertyAttribute.hpp>
 #include <com/sun/star/container/ElementExistException.hpp>
@@ -1364,7 +1366,9 @@ void cppuhelper::ServiceManager::readRdbFile(
                 static_cast< cppu::OWeakObject * >(this));
         }
         SAL_INFO("cppuhelper", "Ignored optional " << uri);
-    } catch (css::registry::InvalidRegistryException & e) {
+    }
+#if !ENABLE_FUZZERS
+    catch (css::registry::InvalidRegistryException & e) {
         if (!readLegacyRdbFile(uri)) {
             throw css::uno::DeploymentException(
                 "InvalidRegistryException: " + e.Message,
@@ -1375,8 +1379,10 @@ void cppuhelper::ServiceManager::readRdbFile(
             throw;
         }
     }
+#endif
 }
 
+#if !ENABLE_FUZZERS
 bool cppuhelper::ServiceManager::readLegacyRdbFile(OUString const & uri) {
     Registry reg;
     switch (reg.open(uri, RegAccessMode::READONLY)) {
@@ -1511,6 +1517,7 @@ void cppuhelper::ServiceManager::readLegacyRdbStrings(
         strings->push_back(names.getElement(i).copy(prefix.getLength()));
     }
 }
+#endif
 
 void cppuhelper::ServiceManager::insertRdbFiles(
     std::vector< OUString > const & uris,
diff --git a/unoidl/Library_unoidl.mk b/unoidl/Library_unoidl.mk
index ff37972eec96..4b3dba1b5ab8 100644
--- a/unoidl/Library_unoidl.mk
+++ b/unoidl/Library_unoidl.mk
@@ -12,13 +12,19 @@ $(eval $(call gb_Library_Library,unoidl))
 $(eval $(call gb_Library_add_defs,unoidl,-DLO_DLLIMPLEMENTATION_UNOIDL))
 
 $(eval $(call gb_Library_add_exception_objects,unoidl, \
-    unoidl/source/legacyprovider \
     unoidl/source/sourcefileprovider \
     unoidl/source/sourcetreeprovider \
     unoidl/source/unoidl \
     unoidl/source/unoidlprovider \
 ))
 
+# drop legacy provider for fuzzing
+ifeq (,$(filter FUZZERS,$(BUILD_TYPE)))
+$(eval $(call gb_Library_add_exception_objects,unoidl, \
+    unoidl/source/legacyprovider \
+))
+endif
+
 $(eval $(call gb_Library_add_grammars,unoidl, \
     unoidl/source/sourceprovider-parser \
 ))
diff --git a/unoidl/source/unoidl.cxx b/unoidl/source/unoidl.cxx
index 2022bcd058ac..acf984613420 100644
--- a/unoidl/source/unoidl.cxx
+++ b/unoidl/source/unoidl.cxx
@@ -14,6 +14,8 @@
 #include <utility>
 #include <vector>
 
+#include <config_fuzzers.h>
+
 #include <osl/file.h>
 #include <osl/file.hxx>
 #include <osl/mutex.hxx>
@@ -21,7 +23,9 @@
 #include <rtl/ustring.hxx>
 #include <unoidl/unoidl.hxx>
 
+#if !ENABLE_FUZZERS
 #include "legacyprovider.hxx"
+#endif
 #include "sourcefileprovider.hxx"
 #include "sourcetreeprovider.hxx"
 #include "unoidlprovider.hxx"
@@ -211,11 +215,16 @@ rtl::Reference< Provider > Manager::loadProvider(OUString 
const & uri) {
     try {
         return new detail::UnoidlProvider(uri);
     } catch (FileFormatException & e) {
+#if !ENABLE_FUZZERS
         SAL_INFO(
             "unoidl",
             "FileFormatException \"" << e.getDetail() << "\", retrying <" << 
uri
                 << "> as legacy format");
         return new detail::LegacyProvider(*this, uri);
+#else
+        (void)e;
+        return nullptr;
+#endif
     }
 }
 
diff --git a/vcl/commonfuzzer.mk b/vcl/commonfuzzer.mk
index 476a68adb0a4..cca33194e9bc 100644
--- a/vcl/commonfuzzer.mk
+++ b/vcl/commonfuzzer.mk
@@ -148,8 +148,6 @@ fuzzer_core_libraries = \
     i18nlangtag \
     xmlreader \
     unoidl \
-    reg \
-    store \
     gcc3_uno \
     salhelper \
     sal \

Reply via email to