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.mcnamara@collabora.com>
This commit is contained in:
Caolán McNamara 2024-02-13 14:59:48 +00:00
parent 1db5b87fe6
commit ca1c8b4471
4 changed files with 24 additions and 4 deletions

View file

@ -17,6 +17,8 @@
#include <utility> #include <utility>
#include <vector> #include <vector>
#include <config_fuzzers.h>
#include <com/sun/star/beans/NamedValue.hpp> #include <com/sun/star/beans/NamedValue.hpp>
#include <com/sun/star/beans/PropertyAttribute.hpp> #include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/container/ElementExistException.hpp> #include <com/sun/star/container/ElementExistException.hpp>
@ -1364,7 +1366,9 @@ void cppuhelper::ServiceManager::readRdbFile(
static_cast< cppu::OWeakObject * >(this)); static_cast< cppu::OWeakObject * >(this));
} }
SAL_INFO("cppuhelper", "Ignored optional " << uri); SAL_INFO("cppuhelper", "Ignored optional " << uri);
} catch (css::registry::InvalidRegistryException & e) { }
#if !ENABLE_FUZZERS
catch (css::registry::InvalidRegistryException & e) {
if (!readLegacyRdbFile(uri)) { if (!readLegacyRdbFile(uri)) {
throw css::uno::DeploymentException( throw css::uno::DeploymentException(
"InvalidRegistryException: " + e.Message, "InvalidRegistryException: " + e.Message,
@ -1375,8 +1379,10 @@ void cppuhelper::ServiceManager::readRdbFile(
throw; throw;
} }
} }
#endif
} }
#if !ENABLE_FUZZERS
bool cppuhelper::ServiceManager::readLegacyRdbFile(OUString const & uri) { bool cppuhelper::ServiceManager::readLegacyRdbFile(OUString const & uri) {
Registry reg; Registry reg;
switch (reg.open(uri, RegAccessMode::READONLY)) { switch (reg.open(uri, RegAccessMode::READONLY)) {
@ -1511,6 +1517,7 @@ void cppuhelper::ServiceManager::readLegacyRdbStrings(
strings->push_back(names.getElement(i).copy(prefix.getLength())); strings->push_back(names.getElement(i).copy(prefix.getLength()));
} }
} }
#endif
void cppuhelper::ServiceManager::insertRdbFiles( void cppuhelper::ServiceManager::insertRdbFiles(
std::vector< OUString > const & uris, std::vector< OUString > const & uris,

View file

@ -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_defs,unoidl,-DLO_DLLIMPLEMENTATION_UNOIDL))
$(eval $(call gb_Library_add_exception_objects,unoidl, \ $(eval $(call gb_Library_add_exception_objects,unoidl, \
unoidl/source/legacyprovider \
unoidl/source/sourcefileprovider \ unoidl/source/sourcefileprovider \
unoidl/source/sourcetreeprovider \ unoidl/source/sourcetreeprovider \
unoidl/source/unoidl \ unoidl/source/unoidl \
unoidl/source/unoidlprovider \ 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, \ $(eval $(call gb_Library_add_grammars,unoidl, \
unoidl/source/sourceprovider-parser \ unoidl/source/sourceprovider-parser \
)) ))

View file

@ -14,6 +14,8 @@
#include <utility> #include <utility>
#include <vector> #include <vector>
#include <config_fuzzers.h>
#include <osl/file.h> #include <osl/file.h>
#include <osl/file.hxx> #include <osl/file.hxx>
#include <osl/mutex.hxx> #include <osl/mutex.hxx>
@ -21,7 +23,9 @@
#include <rtl/ustring.hxx> #include <rtl/ustring.hxx>
#include <unoidl/unoidl.hxx> #include <unoidl/unoidl.hxx>
#if !ENABLE_FUZZERS
#include "legacyprovider.hxx" #include "legacyprovider.hxx"
#endif
#include "sourcefileprovider.hxx" #include "sourcefileprovider.hxx"
#include "sourcetreeprovider.hxx" #include "sourcetreeprovider.hxx"
#include "unoidlprovider.hxx" #include "unoidlprovider.hxx"
@ -211,11 +215,16 @@ rtl::Reference< Provider > Manager::loadProvider(OUString const & uri) {
try { try {
return new detail::UnoidlProvider(uri); return new detail::UnoidlProvider(uri);
} catch (FileFormatException & e) { } catch (FileFormatException & e) {
#if !ENABLE_FUZZERS
SAL_INFO( SAL_INFO(
"unoidl", "unoidl",
"FileFormatException \"" << e.getDetail() << "\", retrying <" << uri "FileFormatException \"" << e.getDetail() << "\", retrying <" << uri
<< "> as legacy format"); << "> as legacy format");
return new detail::LegacyProvider(*this, uri); return new detail::LegacyProvider(*this, uri);
#else
(void)e;
return nullptr;
#endif
} }
} }

View file

@ -148,8 +148,6 @@ fuzzer_core_libraries = \
i18nlangtag \ i18nlangtag \
xmlreader \ xmlreader \
unoidl \ unoidl \
reg \
store \
gcc3_uno \ gcc3_uno \
salhelper \ salhelper \
sal \ sal \