44b36a0602
And check that LIB_FUZZING_ENGINE is set during configure.
Because:
1. It's easier to build locally this way (you don't need to build or hack a
libFuzzingEngine.a - instead you can just specify
LIB_FUZZING_ENGINE=-fsanitize=fuzzer to produce a valid build).
2. Using -lFuzzingEngine is deprecated [1] for various reasons [2].
The old behaviour can be emulated if desired by setting
LIB_FUZZING_ENGINE=-lFuzzingEngine .
This patch was tested as follows:
- Building LO within oss-fuzz via:
python infra/helper.py build_fuzzers --sanitizer address libreoffice </path/to/patched-libreoffice-core>
python infra/helper.py check_build libreoffice
- Building LO fuzzers standalone via:
export CC="clang-11"
export CXX="clang++-11 -stdlib=libc++"
export CFLAGS="-fsanitize=address -fsanitize-address-use-after-scope -fsanitize=fuzzer-no-link -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION"
export CXXFLAGS="$CFLAGS -stdlib=libc++"
export LDFLAGS="$CFLAGS -Wl,--compress-debug-sections,zlib -lpthread"
export LIB_FUZZING_ENGINE=-fsanitize=fuzzer
./autogen.sh --with-distro=LibreOfficeOssFuzz --with-system-libxml
make fuzzers
(--with-system-libxml only appears to be needed because of issues
specific to my build environment/Suse 15.2. I'm invoking clang-11 simply
because that's the most modern clang I have installed, plain clang should
also work on most sufficiently modern systems).
[1]
481280c650/infra/presubmit.py (L46)
[2] https://github.com/google/oss-fuzz/issues/2164
Change-Id: Iddb577c30a39620e72372ef6c2d3fda67f8aabdf
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111691
Tested-by: Jenkins
Tested-by: Caolán McNamara <caolanm@redhat.com>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
48 lines
1.1 KiB
Makefile
48 lines
1.1 KiB
Makefile
# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
|
|
#
|
|
#
|
|
# This file is part of the LibreOffice project.
|
|
#
|
|
# This Source Code Form is subject to the terms of the Mozilla Public
|
|
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
#
|
|
|
|
include $(SRCDIR)/vcl/commonfuzzer.mk
|
|
|
|
$(eval $(call gb_Executable_Executable,ww2fuzzer))
|
|
|
|
$(eval $(call gb_Executable_use_api,ww2fuzzer,\
|
|
offapi \
|
|
udkapi \
|
|
))
|
|
|
|
$(eval $(call gb_Executable_use_externals,ww2fuzzer,\
|
|
$(fuzzer_externals) \
|
|
))
|
|
|
|
$(eval $(call gb_Executable_set_include,ww2fuzzer,\
|
|
$$(INCLUDE) \
|
|
-I$(SRCDIR)/vcl/inc \
|
|
))
|
|
|
|
$(eval $(call gb_Executable_use_libraries,ww2fuzzer,\
|
|
$(fuzzer_writer_libraries) \
|
|
$(fuzzer_core_libraries) \
|
|
))
|
|
|
|
$(eval $(call gb_Executable_use_static_libraries,ww2fuzzer,\
|
|
findsofficepath \
|
|
ulingu \
|
|
fuzzerstubs \
|
|
))
|
|
|
|
$(eval $(call gb_Executable_add_exception_objects,ww2fuzzer,\
|
|
vcl/workben/ww2fuzzer \
|
|
))
|
|
|
|
$(eval $(call gb_Executable_add_libs,ww2fuzzer,\
|
|
$(LIB_FUZZING_ENGINE) \
|
|
))
|
|
|
|
# vim: set noet sw=4 ts=4:
|