add oss-fuzz pdf2fodg fuzzer

Change-Id: I5cb7653339c6280ee7b8f208ce92a771cb1dcc17
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/192134
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
This commit is contained in:
Caolán McNamara
2025-10-10 13:32:14 +02:00
parent 153af9ebb5
commit ab0cec1146
8 changed files with 102 additions and 2 deletions
+1
View File
@@ -142,6 +142,7 @@ $(eval $(call gb_Helper_register_executables_for_install,OOO,brand, \
$(call gb_Helper_optional,FUZZERS,602fuzzer) \
$(call gb_Helper_optional,FUZZERS,lwpfuzzer) \
$(call gb_Helper_optional,FUZZERS,olefuzzer) \
$(call gb_Helper_optional,FUZZERS,pdf2fodgfuzzer) \
$(call gb_Helper_optional,FUZZERS,pptfuzzer) \
$(call gb_Helper_optional,FUZZERS,rtffuzzer) \
$(call gb_Helper_optional,FUZZERS,rtf2pdffuzzer) \
+13
View File
@@ -82,6 +82,7 @@ cd $SRC
curl --no-progress-meter -S \
-C - -O https://raw.githubusercontent.com/google/fuzzing/master/dictionaries/gif.dict \
-C - -O https://raw.githubusercontent.com/google/fuzzing/master/dictionaries/jpeg.dict \
-C - -O https://raw.githubusercontent.com/google/fuzzing/master/dictionaries/pdf.dict \
-C - -O https://raw.githubusercontent.com/google/fuzzing/master/dictionaries/png.dict \
-C - -O https://raw.githubusercontent.com/google/fuzzing/master/dictionaries/tiff.dict \
-C - -O https://raw.githubusercontent.com/google/fuzzing/master/dictionaries/xml.dict \
@@ -112,6 +113,8 @@ mkdir -p afl-testcases && cd afl-testcases/ && tar xf $SRC/afl_testcases.tgz &&
zip -q $SRC/bmpfuzzer_seed_corpus.zip afl-testcases/bmp*/full/images/* && \
zip -q $SRC/pngfuzzer_seed_corpus.zip afl-testcases/png*/full/images/* && \
zip -q $SRC/webpfuzzer_seed_corpus.zip afl-testcases/webp*/full/images/*
# TTF/OTF/SFT
# using github's svn view to use svn export as a hack to just export part of the git repo
# svn support turned off now: https://github.blog/2023-01-20-sunsetting-subversion-support/
# and git sparse checkout is a total pain
@@ -122,6 +125,15 @@ mkdir -p $SRC/sample-sft-fonts/adobe
curl --no-progress-meter -S \
-C - -o $SRC/sample-sft-fonts/adobe/AdobeVFPrototype.otf https://github.com/adobe-fonts/adobe-variable-font-prototype/releases/download/1.005a/AdobeVFPrototype.otf
zip -qr $SRC/sftfuzzer_seed_corpus.zip $SRC/sample-sft-fonts
# PDF
git clone --depth 1 https://github.com/strongcourage/fuzzing-corpus.git && \
zip -q -r $SRC/pdffuzzer_seed_corpus.zip fuzzing-corpus/pdf/* && \
rm -rf fuzzing-corpus && \
git clone --depth 1 https://github.com/mozilla/pdf.js pdf.js && \
zip -q $SRC/pdffuzzer_seed_corpus.zip pdf.js/test/pdfs/*.pdf && \
rm -rf pdf.js
curl --no-progress-meter -S -C - https://storage.googleapis.com/skia-fuzzer/oss-fuzz/svg_seed_corpus.zip -o svgfuzzer_seed_corpus.zip
curl --no-progress-meter -S \
-C - -O https://dev-www.libreoffice.org/corpus/wmffuzzer_seed_corpus.zip \
@@ -172,5 +184,6 @@ cp rtffuzzer_seed_corpus.zip rtf2pdffuzzer_seed_corpus.zip
cp fodsfuzzer_seed_corpus.zip fods2xlsfuzzer_seed_corpus.zip
cp htmlfuzzer_seed_corpus.zip schtmlfuzzer_seed_corpus.zip
cp sftfuzzer_seed_corpus.zip eotfuzzer_seed_corpus.zip
cp pdffuzzer_seed_corpus.zip pdf2fodgfuzzer_seed_corpus.zip
echo end downloading dependencies at `date -u`
+1 -2
View File
@@ -19,8 +19,7 @@
--disable-lpsolve
--disable-mariadb-sdbc
--disable-odk
--disable-pdfimport
--disable-pdfium
--disable-poppler
--disable-postgresql-sdbc
--disable-sdremote
--disable-skia
+48
View File
@@ -0,0 +1,48 @@
# -*- 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,pdf2fodgfuzzer))
$(eval $(call gb_Executable_use_api,pdf2fodgfuzzer,\
offapi \
udkapi \
))
$(eval $(call gb_Executable_use_externals,pdf2fodgfuzzer,\
$(fuzzer_externals) \
))
$(eval $(call gb_Executable_set_include,pdf2fodgfuzzer,\
$$(INCLUDE) \
-I$(SRCDIR)/vcl/inc \
))
$(eval $(call gb_Executable_use_libraries,pdf2fodgfuzzer,\
$(fuzzer_draw_libraries) \
$(fuzzer_core_libraries) \
pdffilter \
))
$(eval $(call gb_Executable_use_static_libraries,pdf2fodgfuzzer,\
$(fuzzer_statics) \
fuzzer_draw \
))
$(eval $(call gb_Executable_add_exception_objects,pdf2fodgfuzzer,\
vcl/workben/pdf2fodgfuzzer \
))
$(eval $(call gb_Executable_add_libs,pdf2fodgfuzzer,\
$(LIB_FUZZING_ENGINE) \
))
# vim: set noet sw=4 ts=4:
+1
View File
@@ -183,6 +183,7 @@ $(eval $(call gb_Module_add_targets,vcl,\
Executable_602fuzzer \
Executable_lwpfuzzer \
Executable_olefuzzer \
Executable_pdf2fodgfuzzer \
Executable_pptfuzzer \
Executable_rtffuzzer \
Executable_rtf2pdffuzzer \
+2
View File
@@ -36,6 +36,7 @@ fuzzer_externals = \
libpng \
libtiff \
libwebp \
pdfium \
md4c \
openssl \
expat \
@@ -137,6 +138,7 @@ fuzzer_core_libraries = \
mtfrenderer \
canvasfactory \
vclcanvas \
pdfimport \
xof \
xmlfa \
xmlfd \
+33
View File
@@ -0,0 +1,33 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* 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 <tools/stream.hxx>
#include <vcl/FilterConfigItem.hxx>
#include "commonfuzzer.hxx"
extern "C" bool TestFODGExportPDF(SvStream& rStream);
extern "C" int LLVMFuzzerInitialize(int* argc, char*** argv)
{
TypicalFuzzerInitialize(argc, argv);
return 0;
}
extern "C" void* SdCreateDialogFactory() { return nullptr; }
extern "C" void* com_sun_star_comp_Draw_VisioImportFilter_get_implementation() { return nullptr; }
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
{
SvMemoryStream aStream(const_cast<uint8_t*>(data), size, StreamMode::READ);
(void)TestFODGExportPDF(aStream);
return 0;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+3
View File
@@ -0,0 +1,3 @@
[libfuzzer]
max_len = 1024
dict = pdf.dict