diff options
author | Caolán McNamara <caolanm@redhat.com> | 2017-10-22 17:29:21 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2017-10-22 21:18:15 +0200 |
commit | aa3c2526893cbf08a08f881b9e4b24dbd2b8b0b7 (patch) | |
tree | effd94dd2ca72bf3ddb250a67e7f08c08f7c8023 /vcl/workben/fftester.cxx | |
parent | 7b2f4b328c68513429657520eca8a8836717c4ec (diff) |
oss-fuzz: drop our own afl related hackery
Change-Id: Ia6a498c07fffd1790ad433287ef4d1cf82085887
Reviewed-on: https://gerrit.libreoffice.org/43695
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl/workben/fftester.cxx')
-rw-r--r-- | vcl/workben/fftester.cxx | 867 |
1 files changed, 416 insertions, 451 deletions
diff --git a/vcl/workben/fftester.cxx b/vcl/workben/fftester.cxx index a39e3ddc9f2e..18c84d52fb27 100644 --- a/vcl/workben/fftester.cxx +++ b/vcl/workben/fftester.cxx @@ -18,18 +18,9 @@ */ /* e.g. - export CC=afl-clang-fast - export CXX=afl-clang-fast++ make cp workdir/LinkTarget/Executable/fftester instdir/program - LD_LIBRARY_PATH=`pwd`/instdir/program AFL_PERSISTENT=1 afl-fuzz -t 50 -i ~/fuzz/in.png -o ~/fuzz/out.png -d -T png -m 50000000 instdir/program/fftester @@ png - - On slower file formats like .doc you can probably drop the -t and rely on the - estimations, on faster file formats ironically not specifying a timeout will - result in a hilarious dramatic falloff in performance from thousands per second - to teens per second as tiny variations from the initial calculated - timeout will trigger a shutdown of the fftester and a restart and the - startup time is woeful (hence the AFL_PERSISTENT mode in the first place) + LD_LIBRARY_PATH=`pwd`/instdir/program instdir/program/fftester <foo> png */ #include <sal/main.h> @@ -50,8 +41,6 @@ #include <vcl/wrkwin.hxx> #include <vcl/fltcall.hxx> #include <osl/file.hxx> -#include <unistd.h> -#include <signal.h> #include <../source/filter/igif/gifread.hxx> #include <../source/filter/ixbm/xbmread.hxx> @@ -69,13 +58,6 @@ extern "C" { static void SAL_CALL thisModule() {} } typedef bool (*WFilterCall)(const OUString &rUrl); typedef bool (*FFilterCall)(SvStream &rStream); -/* This constant specifies the number of inputs to process before restarting. - * This is optional, but helps limit the impact of memory leaks and similar - * hiccups. */ - -#define PERSIST_MAX 1000 -static unsigned int persist_cnt; - SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) { int ret = -1; @@ -109,481 +91,464 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) utl::ConfigManager::EnableAvoidConfig(); InitVCL(); -try_again: - + if (strcmp(argv[2], "wmf") == 0 || strcmp(argv[2], "emf") == 0) { - if (strcmp(argv[2], "wmf") == 0 || strcmp(argv[2], "emf") == 0) - { - GDIMetaFile aGDIMetaFile; - SvFileStream aFileStream(out, StreamMode::READ); - ret = (int) ReadWindowMetafile(aFileStream, aGDIMetaFile); - } - else if (strcmp(argv[2], "jpg") == 0) - { - Graphic aGraphic; - SvFileStream aFileStream(out, StreamMode::READ); - ret = (int) ImportJPEG(aFileStream, aGraphic, GraphicFilterImportFlags::NONE, nullptr); - } - else if (strcmp(argv[2], "gif") == 0) - { - SvFileStream aFileStream(out, StreamMode::READ); - Graphic aGraphic; - ret = (int) ImportGIF(aFileStream, aGraphic); - } - else if (strcmp(argv[2], "xbm") == 0) - { - Graphic aGraphic; - SvFileStream aFileStream(out, StreamMode::READ); - ret = (int) ImportXBM(aFileStream, aGraphic); - } - else if (strcmp(argv[2], "xpm") == 0) - { - Graphic aGraphic; - SvFileStream aFileStream(out, StreamMode::READ); - ret = (int) ImportXPM(aFileStream, aGraphic); - } - else if (strcmp(argv[2], "png") == 0) - { - SvFileStream aFileStream(out, StreamMode::READ); - vcl::PNGReader aReader(aFileStream); - } - else if (strcmp(argv[2], "bmp") == 0) - { - Bitmap aTarget; - SvFileStream aFileStream(out, StreamMode::READ); - ret = (int) ReadDIB(aTarget, aFileStream, true); - } - else if (strcmp(argv[2], "svm") == 0) - { - GDIMetaFile aGDIMetaFile; - SvFileStream aFileStream(out, StreamMode::READ); - ReadGDIMetaFile(aFileStream, aGDIMetaFile); - } + GDIMetaFile aGDIMetaFile; + SvFileStream aFileStream(out, StreamMode::READ); + ret = (int) ReadWindowMetafile(aFileStream, aGDIMetaFile); + } + else if (strcmp(argv[2], "jpg") == 0) + { + Graphic aGraphic; + SvFileStream aFileStream(out, StreamMode::READ); + ret = (int) ImportJPEG(aFileStream, aGraphic, GraphicFilterImportFlags::NONE, nullptr); + } + else if (strcmp(argv[2], "gif") == 0) + { + SvFileStream aFileStream(out, StreamMode::READ); + Graphic aGraphic; + ret = (int) ImportGIF(aFileStream, aGraphic); + } + else if (strcmp(argv[2], "xbm") == 0) + { + Graphic aGraphic; + SvFileStream aFileStream(out, StreamMode::READ); + ret = (int) ImportXBM(aFileStream, aGraphic); + } + else if (strcmp(argv[2], "xpm") == 0) + { + Graphic aGraphic; + SvFileStream aFileStream(out, StreamMode::READ); + ret = (int) ImportXPM(aFileStream, aGraphic); + } + else if (strcmp(argv[2], "png") == 0) + { + SvFileStream aFileStream(out, StreamMode::READ); + vcl::PNGReader aReader(aFileStream); + } + else if (strcmp(argv[2], "bmp") == 0) + { + Bitmap aTarget; + SvFileStream aFileStream(out, StreamMode::READ); + ret = (int) ReadDIB(aTarget, aFileStream, true); + } + else if (strcmp(argv[2], "svm") == 0) + { + GDIMetaFile aGDIMetaFile; + SvFileStream aFileStream(out, StreamMode::READ); + ReadGDIMetaFile(aFileStream, aGDIMetaFile); + } #ifndef DISABLE_DYNLOADING - else if (strcmp(argv[2], "pcd") == 0) - { - static PFilterCall pfnImport(nullptr); - if (!pfnImport) - { - osl::Module aLibrary; - aLibrary.loadRelative(&thisModule, "libgielo.so"); - pfnImport = reinterpret_cast<PFilterCall>( - aLibrary.getFunctionSymbol("icdGraphicImport")); - aLibrary.release(); - } - Graphic aGraphic; - SvFileStream aFileStream(out, StreamMode::READ); - ret = (int) (*pfnImport)(aFileStream, aGraphic, nullptr); - } - else if (strcmp(argv[2], "dxf") == 0) - { - static PFilterCall pfnImport(nullptr); - if (!pfnImport) - { - osl::Module aLibrary; - aLibrary.loadRelative(&thisModule, "libgielo.so"); - pfnImport = reinterpret_cast<PFilterCall>( - aLibrary.getFunctionSymbol("idxGraphicImport")); - aLibrary.release(); - } - Graphic aGraphic; - SvFileStream aFileStream(out, StreamMode::READ); - ret = (int) (*pfnImport)(aFileStream, aGraphic, nullptr); - } - else if (strcmp(argv[2], "met") == 0) - { - static PFilterCall pfnImport(nullptr); - if (!pfnImport) - { - osl::Module aLibrary; - aLibrary.loadRelative(&thisModule, "libgielo.so"); - pfnImport = reinterpret_cast<PFilterCall>( - aLibrary.getFunctionSymbol("imeGraphicImport")); - aLibrary.release(); - } - Graphic aGraphic; - SvFileStream aFileStream(out, StreamMode::READ); - ret = (int) (*pfnImport)(aFileStream, aGraphic, nullptr); - } - else if ((strcmp(argv[2], "pbm") == 0) || strcmp(argv[2], "ppm") == 0) - { - static PFilterCall pfnImport(nullptr); - if (!pfnImport) - { - osl::Module aLibrary; - aLibrary.loadRelative(&thisModule, "libgielo.so"); - pfnImport = reinterpret_cast<PFilterCall>( - aLibrary.getFunctionSymbol("ipbGraphicImport")); - aLibrary.release(); - } - Graphic aGraphic; - SvFileStream aFileStream(out, StreamMode::READ); - ret = (int) (*pfnImport)(aFileStream, aGraphic, nullptr); - } - else if (strcmp(argv[2], "psd") == 0) - { - static PFilterCall pfnImport(nullptr); - if (!pfnImport) - { - osl::Module aLibrary; - aLibrary.loadRelative(&thisModule, "libgielo.so"); - pfnImport = reinterpret_cast<PFilterCall>( - aLibrary.getFunctionSymbol("ipdGraphicImport")); - aLibrary.release(); - } - Graphic aGraphic; - SvFileStream aFileStream(out, StreamMode::READ); - ret = (int) (*pfnImport)(aFileStream, aGraphic, nullptr); - } - else if (strcmp(argv[2], "eps") == 0) - { - static PFilterCall pfnImport(nullptr); - if (!pfnImport) - { - osl::Module aLibrary; - aLibrary.loadRelative(&thisModule, "libgielo.so"); - pfnImport = reinterpret_cast<PFilterCall>( - aLibrary.getFunctionSymbol("ipsGraphicImport")); - aLibrary.release(); - } - Graphic aGraphic; - SvFileStream aFileStream(out, StreamMode::READ); - ret = (int) (*pfnImport)(aFileStream, aGraphic, nullptr); - } - else if (strcmp(argv[2], "pct") == 0) - { - static PFilterCall pfnImport(nullptr); - if (!pfnImport) - { - osl::Module aLibrary; - aLibrary.loadRelative(&thisModule, "libgielo.so"); - pfnImport = reinterpret_cast<PFilterCall>( - aLibrary.getFunctionSymbol("iptGraphicImport")); - aLibrary.release(); - } - Graphic aGraphic; - SvFileStream aFileStream(out, StreamMode::READ); - ret = (int) (*pfnImport)(aFileStream, aGraphic, nullptr); - } - else if (strcmp(argv[2], "pcx") == 0) - { - static PFilterCall pfnImport(nullptr); - if (!pfnImport) - { - osl::Module aLibrary; - aLibrary.loadRelative(&thisModule, "libgielo.so"); - pfnImport = reinterpret_cast<PFilterCall>( - aLibrary.getFunctionSymbol("ipxGraphicImport")); - aLibrary.release(); - } - Graphic aGraphic; - SvFileStream aFileStream(out, StreamMode::READ); - ret = (int) (*pfnImport)(aFileStream, aGraphic, nullptr); - } - else if (strcmp(argv[2], "ras") == 0) - { - static PFilterCall pfnImport(nullptr); - if (!pfnImport) - { - osl::Module aLibrary; - aLibrary.loadRelative(&thisModule, "libgielo.so"); - pfnImport = reinterpret_cast<PFilterCall>( - aLibrary.getFunctionSymbol("iraGraphicImport")); - aLibrary.release(); - } - Graphic aGraphic; - SvFileStream aFileStream(out, StreamMode::READ); - ret = (int) (*pfnImport)(aFileStream, aGraphic, nullptr); - } - else if (strcmp(argv[2], "tga") == 0) - { - static PFilterCall pfnImport(nullptr); - if (!pfnImport) - { - osl::Module aLibrary; - aLibrary.loadRelative(&thisModule, "libgielo.so"); - pfnImport = reinterpret_cast<PFilterCall>( - aLibrary.getFunctionSymbol("itgGraphicImport")); - aLibrary.release(); - } - Graphic aGraphic; - SvFileStream aFileStream(out, StreamMode::READ); - ret = (int) (*pfnImport)(aFileStream, aGraphic, nullptr); - } - else if (strcmp(argv[2], "tif") == 0) - { - static PFilterCall pfnImport(nullptr); - if (!pfnImport) - { - osl::Module aLibrary; - aLibrary.loadRelative(&thisModule, "libgielo.so"); - pfnImport = reinterpret_cast<PFilterCall>( - aLibrary.getFunctionSymbol("itiGraphicImport")); - aLibrary.release(); - } - Graphic aGraphic; - SvFileStream aFileStream(out, StreamMode::READ); - ret = (int) (*pfnImport)(aFileStream, aGraphic, nullptr); - } - else if ((strcmp(argv[2], "doc") == 0) || (strcmp(argv[2], "ww8") == 0)) - { - static FFilterCall pfnImport(nullptr); - if (!pfnImport) - { - osl::Module aLibrary; - aLibrary.loadRelative(&thisModule, "libmswordlo.so", SAL_LOADMODULE_LAZY); - pfnImport = reinterpret_cast<FFilterCall>( - aLibrary.getFunctionSymbol("TestImportWW8")); - aLibrary.release(); - } - SvFileStream aFileStream(out, StreamMode::READ); - ret = (int) (*pfnImport)(aFileStream); - } - else if (strcmp(argv[2], "ww6") == 0) + else if (strcmp(argv[2], "pcd") == 0) + { + static PFilterCall pfnImport(nullptr); + if (!pfnImport) + { + osl::Module aLibrary; + aLibrary.loadRelative(&thisModule, "libgielo.so"); + pfnImport = reinterpret_cast<PFilterCall>( + aLibrary.getFunctionSymbol("icdGraphicImport")); + aLibrary.release(); + } + Graphic aGraphic; + SvFileStream aFileStream(out, StreamMode::READ); + ret = (int) (*pfnImport)(aFileStream, aGraphic, nullptr); + } + else if (strcmp(argv[2], "dxf") == 0) + { + static PFilterCall pfnImport(nullptr); + if (!pfnImport) + { + osl::Module aLibrary; + aLibrary.loadRelative(&thisModule, "libgielo.so"); + pfnImport = reinterpret_cast<PFilterCall>( + aLibrary.getFunctionSymbol("idxGraphicImport")); + aLibrary.release(); + } + Graphic aGraphic; + SvFileStream aFileStream(out, StreamMode::READ); + ret = (int) (*pfnImport)(aFileStream, aGraphic, nullptr); + } + else if (strcmp(argv[2], "met") == 0) + { + static PFilterCall pfnImport(nullptr); + if (!pfnImport) + { + osl::Module aLibrary; + aLibrary.loadRelative(&thisModule, "libgielo.so"); + pfnImport = reinterpret_cast<PFilterCall>( + aLibrary.getFunctionSymbol("imeGraphicImport")); + aLibrary.release(); + } + Graphic aGraphic; + SvFileStream aFileStream(out, StreamMode::READ); + ret = (int) (*pfnImport)(aFileStream, aGraphic, nullptr); + } + else if ((strcmp(argv[2], "pbm") == 0) || strcmp(argv[2], "ppm") == 0) + { + static PFilterCall pfnImport(nullptr); + if (!pfnImport) + { + osl::Module aLibrary; + aLibrary.loadRelative(&thisModule, "libgielo.so"); + pfnImport = reinterpret_cast<PFilterCall>( + aLibrary.getFunctionSymbol("ipbGraphicImport")); + aLibrary.release(); + } + Graphic aGraphic; + SvFileStream aFileStream(out, StreamMode::READ); + ret = (int) (*pfnImport)(aFileStream, aGraphic, nullptr); + } + else if (strcmp(argv[2], "psd") == 0) + { + static PFilterCall pfnImport(nullptr); + if (!pfnImport) + { + osl::Module aLibrary; + aLibrary.loadRelative(&thisModule, "libgielo.so"); + pfnImport = reinterpret_cast<PFilterCall>( + aLibrary.getFunctionSymbol("ipdGraphicImport")); + aLibrary.release(); + } + Graphic aGraphic; + SvFileStream aFileStream(out, StreamMode::READ); + ret = (int) (*pfnImport)(aFileStream, aGraphic, nullptr); + } + else if (strcmp(argv[2], "eps") == 0) + { + static PFilterCall pfnImport(nullptr); + if (!pfnImport) + { + osl::Module aLibrary; + aLibrary.loadRelative(&thisModule, "libgielo.so"); + pfnImport = reinterpret_cast<PFilterCall>( + aLibrary.getFunctionSymbol("ipsGraphicImport")); + aLibrary.release(); + } + Graphic aGraphic; + SvFileStream aFileStream(out, StreamMode::READ); + ret = (int) (*pfnImport)(aFileStream, aGraphic, nullptr); + } + else if (strcmp(argv[2], "pct") == 0) + { + static PFilterCall pfnImport(nullptr); + if (!pfnImport) + { + osl::Module aLibrary; + aLibrary.loadRelative(&thisModule, "libgielo.so"); + pfnImport = reinterpret_cast<PFilterCall>( + aLibrary.getFunctionSymbol("iptGraphicImport")); + aLibrary.release(); + } + Graphic aGraphic; + SvFileStream aFileStream(out, StreamMode::READ); + ret = (int) (*pfnImport)(aFileStream, aGraphic, nullptr); + } + else if (strcmp(argv[2], "pcx") == 0) + { + static PFilterCall pfnImport(nullptr); + if (!pfnImport) + { + osl::Module aLibrary; + aLibrary.loadRelative(&thisModule, "libgielo.so"); + pfnImport = reinterpret_cast<PFilterCall>( + aLibrary.getFunctionSymbol("ipxGraphicImport")); + aLibrary.release(); + } + Graphic aGraphic; + SvFileStream aFileStream(out, StreamMode::READ); + ret = (int) (*pfnImport)(aFileStream, aGraphic, nullptr); + } + else if (strcmp(argv[2], "ras") == 0) + { + static PFilterCall pfnImport(nullptr); + if (!pfnImport) + { + osl::Module aLibrary; + aLibrary.loadRelative(&thisModule, "libgielo.so"); + pfnImport = reinterpret_cast<PFilterCall>( + aLibrary.getFunctionSymbol("iraGraphicImport")); + aLibrary.release(); + } + Graphic aGraphic; + SvFileStream aFileStream(out, StreamMode::READ); + ret = (int) (*pfnImport)(aFileStream, aGraphic, nullptr); + } + else if (strcmp(argv[2], "tga") == 0) + { + static PFilterCall pfnImport(nullptr); + if (!pfnImport) + { + osl::Module aLibrary; + aLibrary.loadRelative(&thisModule, "libgielo.so"); + pfnImport = reinterpret_cast<PFilterCall>( + aLibrary.getFunctionSymbol("itgGraphicImport")); + aLibrary.release(); + } + Graphic aGraphic; + SvFileStream aFileStream(out, StreamMode::READ); + ret = (int) (*pfnImport)(aFileStream, aGraphic, nullptr); + } + else if (strcmp(argv[2], "tif") == 0) + { + static PFilterCall pfnImport(nullptr); + if (!pfnImport) + { + osl::Module aLibrary; + aLibrary.loadRelative(&thisModule, "libgielo.so"); + pfnImport = reinterpret_cast<PFilterCall>( + aLibrary.getFunctionSymbol("itiGraphicImport")); + aLibrary.release(); + } + Graphic aGraphic; + SvFileStream aFileStream(out, StreamMode::READ); + ret = (int) (*pfnImport)(aFileStream, aGraphic, nullptr); + } + else if ((strcmp(argv[2], "doc") == 0) || (strcmp(argv[2], "ww8") == 0)) + { + static FFilterCall pfnImport(nullptr); + if (!pfnImport) { - static FFilterCall pfnImport(nullptr); - if (!pfnImport) - { - osl::Module aLibrary; - aLibrary.loadRelative(&thisModule, "libmswordlo.so", SAL_LOADMODULE_LAZY); - pfnImport = reinterpret_cast<FFilterCall>( - aLibrary.getFunctionSymbol("TestImportWW6")); - aLibrary.release(); - } - SvFileStream aFileStream(out, StreamMode::READ); - ret = (int) (*pfnImport)(aFileStream); + osl::Module aLibrary; + aLibrary.loadRelative(&thisModule, "libmswordlo.so", SAL_LOADMODULE_LAZY); + pfnImport = reinterpret_cast<FFilterCall>( + aLibrary.getFunctionSymbol("TestImportWW8")); + aLibrary.release(); } - else if (strcmp(argv[2], "ww2") == 0) + SvFileStream aFileStream(out, StreamMode::READ); + ret = (int) (*pfnImport)(aFileStream); + } + else if (strcmp(argv[2], "ww6") == 0) + { + static FFilterCall pfnImport(nullptr); + if (!pfnImport) { - static FFilterCall pfnImport(nullptr); - if (!pfnImport) - { - osl::Module aLibrary; - aLibrary.loadRelative(&thisModule, "libmswordlo.so", SAL_LOADMODULE_LAZY); - pfnImport = reinterpret_cast<FFilterCall>( - aLibrary.getFunctionSymbol("TestImportWW2")); - aLibrary.release(); - } - SvFileStream aFileStream(out, StreamMode::READ); - ret = (int) (*pfnImport)(aFileStream); + osl::Module aLibrary; + aLibrary.loadRelative(&thisModule, "libmswordlo.so", SAL_LOADMODULE_LAZY); + pfnImport = reinterpret_cast<FFilterCall>( + aLibrary.getFunctionSymbol("TestImportWW6")); + aLibrary.release(); } - else if (strcmp(argv[2], "rtf") == 0) + SvFileStream aFileStream(out, StreamMode::READ); + ret = (int) (*pfnImport)(aFileStream); + } + else if (strcmp(argv[2], "ww2") == 0) + { + static FFilterCall pfnImport(nullptr); + if (!pfnImport) { - static FFilterCall pfnImport(nullptr); - if (!pfnImport) - { - osl::Module aLibrary; - aLibrary.loadRelative(&thisModule, "libmswordlo.so", SAL_LOADMODULE_LAZY); - pfnImport = reinterpret_cast<FFilterCall>( - aLibrary.getFunctionSymbol("TestImportRTF")); - aLibrary.release(); - } - SvFileStream aFileStream(out, StreamMode::READ); - ret = (int) (*pfnImport)(aFileStream); + osl::Module aLibrary; + aLibrary.loadRelative(&thisModule, "libmswordlo.so", SAL_LOADMODULE_LAZY); + pfnImport = reinterpret_cast<FFilterCall>( + aLibrary.getFunctionSymbol("TestImportWW2")); + aLibrary.release(); } - else if (strcmp(argv[2], "fodt") == 0) + SvFileStream aFileStream(out, StreamMode::READ); + ret = (int) (*pfnImport)(aFileStream); + } + else if (strcmp(argv[2], "rtf") == 0) + { + static FFilterCall pfnImport(nullptr); + if (!pfnImport) { - static FFilterCall pfnImport(nullptr); - if (!pfnImport) - { - osl::Module aLibrary; - aLibrary.loadRelative(&thisModule, "libswlo.so", SAL_LOADMODULE_LAZY); - pfnImport = reinterpret_cast<FFilterCall>( - aLibrary.getFunctionSymbol("TestImportFODT")); - aLibrary.release(); - } - SvFileStream aFileStream(out, StreamMode::READ); - ret = (int) (*pfnImport)(aFileStream); + osl::Module aLibrary; + aLibrary.loadRelative(&thisModule, "libmswordlo.so", SAL_LOADMODULE_LAZY); + pfnImport = reinterpret_cast<FFilterCall>( + aLibrary.getFunctionSymbol("TestImportRTF")); + aLibrary.release(); } - else if (strcmp(argv[2], "fods") == 0) + SvFileStream aFileStream(out, StreamMode::READ); + ret = (int) (*pfnImport)(aFileStream); + } + else if (strcmp(argv[2], "fodt") == 0) + { + static FFilterCall pfnImport(nullptr); + if (!pfnImport) { - static FFilterCall pfnImport(nullptr); - if (!pfnImport) - { - osl::Module aLibrary; - aLibrary.loadRelative(&thisModule, "libsclo.so", SAL_LOADMODULE_LAZY); - pfnImport = reinterpret_cast<FFilterCall>( - aLibrary.getFunctionSymbol("TestImportFODS")); - aLibrary.release(); - } - SvFileStream aFileStream(out, StreamMode::READ); - ret = (int) (*pfnImport)(aFileStream); + osl::Module aLibrary; + aLibrary.loadRelative(&thisModule, "libswlo.so", SAL_LOADMODULE_LAZY); + pfnImport = reinterpret_cast<FFilterCall>( + aLibrary.getFunctionSymbol("TestImportFODT")); + aLibrary.release(); } - else if (strcmp(argv[2], "fodp") == 0) + SvFileStream aFileStream(out, StreamMode::READ); + ret = (int) (*pfnImport)(aFileStream); + } + else if (strcmp(argv[2], "fods") == 0) + { + static FFilterCall pfnImport(nullptr); + if (!pfnImport) { - static FFilterCall pfnImport(nullptr); - if (!pfnImport) - { - osl::Module aLibrary; - aLibrary.loadRelative(&thisModule, "libsdlo.so", SAL_LOADMODULE_LAZY); - pfnImport = reinterpret_cast<FFilterCall>( - aLibrary.getFunctionSymbol("TestImportFODP")); - aLibrary.release(); - } - SvFileStream aFileStream(out, StreamMode::READ); - ret = (int) (*pfnImport)(aFileStream); + osl::Module aLibrary; + aLibrary.loadRelative(&thisModule, "libsclo.so", SAL_LOADMODULE_LAZY); + pfnImport = reinterpret_cast<FFilterCall>( + aLibrary.getFunctionSymbol("TestImportFODS")); + aLibrary.release(); } - else if (strcmp(argv[2], "xls") == 0) + SvFileStream aFileStream(out, StreamMode::READ); + ret = (int) (*pfnImport)(aFileStream); + } + else if (strcmp(argv[2], "fodp") == 0) + { + static FFilterCall pfnImport(nullptr); + if (!pfnImport) { - static WFilterCall pfnImport(nullptr); - if (!pfnImport) - { - osl::Module aLibrary; - aLibrary.loadRelative(&thisModule, "libscfiltlo.so", SAL_LOADMODULE_LAZY); - pfnImport = reinterpret_cast<WFilterCall>( - aLibrary.getFunctionSymbol("TestImportXLS")); - aLibrary.release(); - } - ret = (int) (*pfnImport)(out); + osl::Module aLibrary; + aLibrary.loadRelative(&thisModule, "libsdlo.so", SAL_LOADMODULE_LAZY); + pfnImport = reinterpret_cast<FFilterCall>( + aLibrary.getFunctionSymbol("TestImportFODP")); + aLibrary.release(); } - else if (strcmp(argv[2], "hwp") == 0) + SvFileStream aFileStream(out, StreamMode::READ); + ret = (int) (*pfnImport)(aFileStream); + } + else if (strcmp(argv[2], "xls") == 0) + { + static WFilterCall pfnImport(nullptr); + if (!pfnImport) { - static FFilterCall pfnImport(nullptr); - if (!pfnImport) - { - osl::Module aLibrary; - aLibrary.loadRelative(&thisModule, "libhwplo.so", SAL_LOADMODULE_LAZY); - pfnImport = reinterpret_cast<FFilterCall>( - aLibrary.getFunctionSymbol("TestImportHWP")); - aLibrary.release(); - } - SvFileStream aFileStream(out, StreamMode::READ); - ret = (int) (*pfnImport)(aFileStream); + osl::Module aLibrary; + aLibrary.loadRelative(&thisModule, "libscfiltlo.so", SAL_LOADMODULE_LAZY); + pfnImport = reinterpret_cast<WFilterCall>( + aLibrary.getFunctionSymbol("TestImportXLS")); + aLibrary.release(); } - else if (strcmp(argv[2], "602") == 0) + ret = (int) (*pfnImport)(out); + } + else if (strcmp(argv[2], "hwp") == 0) + { + static FFilterCall pfnImport(nullptr); + if (!pfnImport) { - static FFilterCall pfnImport(nullptr); - if (!pfnImport) - { - osl::Module aLibrary; - aLibrary.loadRelative(&thisModule, "libt602filterlo.so", SAL_LOADMODULE_LAZY); - pfnImport = reinterpret_cast<FFilterCall>( - aLibrary.getFunctionSymbol("TestImport602")); - aLibrary.release(); - } - SvFileStream aFileStream(out, StreamMode::READ); - ret = (int) (*pfnImport)(aFileStream); + osl::Module aLibrary; + aLibrary.loadRelative(&thisModule, "libhwplo.so", SAL_LOADMODULE_LAZY); + pfnImport = reinterpret_cast<FFilterCall>( + aLibrary.getFunctionSymbol("TestImportHWP")); + aLibrary.release(); } - else if (strcmp(argv[2], "lwp") == 0) + SvFileStream aFileStream(out, StreamMode::READ); + ret = (int) (*pfnImport)(aFileStream); + } + else if (strcmp(argv[2], "602") == 0) + { + static FFilterCall pfnImport(nullptr); + if (!pfnImport) { - static FFilterCall pfnImport(nullptr); - if (!pfnImport) - { - osl::Module aLibrary; - aLibrary.loadRelative(&thisModule, "liblwpftlo.so", SAL_LOADMODULE_LAZY); - pfnImport = reinterpret_cast<FFilterCall>( - aLibrary.getFunctionSymbol("TestImportLWP")); - aLibrary.release(); - } - SvFileStream aFileStream(out, StreamMode::READ); - ret = (int) (*pfnImport)(aFileStream); + osl::Module aLibrary; + aLibrary.loadRelative(&thisModule, "libt602filterlo.so", SAL_LOADMODULE_LAZY); + pfnImport = reinterpret_cast<FFilterCall>( + aLibrary.getFunctionSymbol("TestImport602")); + aLibrary.release(); } - else if (strcmp(argv[2], "ppt") == 0) + SvFileStream aFileStream(out, StreamMode::READ); + ret = (int) (*pfnImport)(aFileStream); + } + else if (strcmp(argv[2], "lwp") == 0) + { + static FFilterCall pfnImport(nullptr); + if (!pfnImport) { - static FFilterCall pfnImport(nullptr); - if (!pfnImport) - { - osl::Module aLibrary; - aLibrary.loadRelative(&thisModule, "libsdfiltlo.so", SAL_LOADMODULE_LAZY); - pfnImport = reinterpret_cast<FFilterCall>( - aLibrary.getFunctionSymbol("TestImportPPT")); - aLibrary.release(); - } - SvFileStream aFileStream(out, StreamMode::READ); - ret = (int) (*pfnImport)(aFileStream); + osl::Module aLibrary; + aLibrary.loadRelative(&thisModule, "liblwpftlo.so", SAL_LOADMODULE_LAZY); + pfnImport = reinterpret_cast<FFilterCall>( + aLibrary.getFunctionSymbol("TestImportLWP")); + aLibrary.release(); } - else if (strcmp(argv[2], "cgm") == 0) + SvFileStream aFileStream(out, StreamMode::READ); + ret = (int) (*pfnImport)(aFileStream); + } + else if (strcmp(argv[2], "ppt") == 0) + { + static FFilterCall pfnImport(nullptr); + if (!pfnImport) { - static FFilterCall pfnImport(nullptr); - if (!pfnImport) - { - osl::Module aLibrary; - aLibrary.loadRelative(&thisModule, "libsdlo.so", SAL_LOADMODULE_LAZY); - pfnImport = reinterpret_cast<FFilterCall>( - aLibrary.getFunctionSymbol("TestImportCGM")); - aLibrary.release(); - } - SvFileStream aFileStream(out, StreamMode::READ); - ret = (int) (*pfnImport)(aFileStream); + osl::Module aLibrary; + aLibrary.loadRelative(&thisModule, "libsdfiltlo.so", SAL_LOADMODULE_LAZY); + pfnImport = reinterpret_cast<FFilterCall>( + aLibrary.getFunctionSymbol("TestImportPPT")); + aLibrary.release(); } - else if (strcmp(argv[2], "qpw") == 0) + SvFileStream aFileStream(out, StreamMode::READ); + ret = (int) (*pfnImport)(aFileStream); + } + else if (strcmp(argv[2], "cgm") == 0) + { + static FFilterCall pfnImport(nullptr); + if (!pfnImport) { - static FFilterCall pfnImport(nullptr); - if (!pfnImport) - { - osl::Module aLibrary; - aLibrary.loadRelative(&thisModule, "libscfiltlo.so", SAL_LOADMODULE_LAZY); - pfnImport = reinterpret_cast<FFilterCall>( - aLibrary.getFunctionSymbol("TestImportQPW")); - aLibrary.release(); - } - SvFileStream aFileStream(out, StreamMode::READ); - ret = (int) (*pfnImport)(aFileStream); + osl::Module aLibrary; + aLibrary.loadRelative(&thisModule, "libsdlo.so", SAL_LOADMODULE_LAZY); + pfnImport = reinterpret_cast<FFilterCall>( + aLibrary.getFunctionSymbol("TestImportCGM")); + aLibrary.release(); } - else if (strcmp(argv[2], "sc-rtf") == 0) + SvFileStream aFileStream(out, StreamMode::READ); + ret = (int) (*pfnImport)(aFileStream); + } + else if (strcmp(argv[2], "qpw") == 0) + { + static FFilterCall pfnImport(nullptr); + if (!pfnImport) { - static FFilterCall pfnImport(nullptr); - if (!pfnImport) - { - osl::Module aLibrary; - aLibrary.loadRelative(&thisModule, "libscfiltlo.so", SAL_LOADMODULE_LAZY); - pfnImport = reinterpret_cast<FFilterCall>( - aLibrary.getFunctionSymbol("TestImportCalcRTF")); - aLibrary.release(); - } - SvFileStream aFileStream(out, StreamMode::READ); - ret = (int) (*pfnImport)(aFileStream); + osl::Module aLibrary; + aLibrary.loadRelative(&thisModule, "libscfiltlo.so", SAL_LOADMODULE_LAZY); + pfnImport = reinterpret_cast<FFilterCall>( + aLibrary.getFunctionSymbol("TestImportQPW")); + aLibrary.release(); } - else if (strcmp(argv[2], "slk") == 0) + SvFileStream aFileStream(out, StreamMode::READ); + ret = (int) (*pfnImport)(aFileStream); + } + else if (strcmp(argv[2], "sc-rtf") == 0) + { + static FFilterCall pfnImport(nullptr); + if (!pfnImport) { - static FFilterCall pfnImport(nullptr); - if (!pfnImport) - { - osl::Module aLibrary; - aLibrary.loadRelative(&thisModule, "libsclo.so", SAL_LOADMODULE_LAZY); - pfnImport = reinterpret_cast<FFilterCall>( - aLibrary.getFunctionSymbol("TestImportSLK")); - aLibrary.release(); - } - SvFileStream aFileStream(out, StreamMode::READ); - ret = (int) (*pfnImport)(aFileStream); + osl::Module aLibrary; + aLibrary.loadRelative(&thisModule, "libscfiltlo.so", SAL_LOADMODULE_LAZY); + pfnImport = reinterpret_cast<FFilterCall>( + aLibrary.getFunctionSymbol("TestImportCalcRTF")); + aLibrary.release(); } - else if (strcmp(argv[2], "ole") == 0) + SvFileStream aFileStream(out, StreamMode::READ); + ret = (int) (*pfnImport)(aFileStream); + } + else if (strcmp(argv[2], "slk") == 0) + { + static FFilterCall pfnImport(nullptr); + if (!pfnImport) { - static FFilterCall pfnImport(nullptr); - if (!pfnImport) - { - osl::Module aLibrary; - aLibrary.loadRelative(&thisModule, "libsotlo.so", SAL_LOADMODULE_LAZY); - pfnImport = reinterpret_cast<FFilterCall>( - aLibrary.getFunctionSymbol("TestImportOLE2")); - aLibrary.release(); - } - SvFileStream aFileStream(out, StreamMode::READ); - ret = (int) (*pfnImport)(aFileStream); + osl::Module aLibrary; + aLibrary.loadRelative(&thisModule, "libsclo.so", SAL_LOADMODULE_LAZY); + pfnImport = reinterpret_cast<FFilterCall>( + aLibrary.getFunctionSymbol("TestImportSLK")); + aLibrary.release(); } -#endif + SvFileStream aFileStream(out, StreamMode::READ); + ret = (int) (*pfnImport)(aFileStream); } - - /* To signal successful completion of a run, we need to deliver - SIGSTOP to our own process, then loop to the very beginning - once we're resumed by the supervisor process. We do this only - if AFL_PERSISTENT is set to retain normal behavior when the - program is executed directly; and take note of PERSIST_MAX. */ - if (getenv("AFL_PERSISTENT") && persist_cnt++ < PERSIST_MAX) + else if (strcmp(argv[2], "ole") == 0) { - raise(SIGSTOP); - goto try_again; + static FFilterCall pfnImport(nullptr); + if (!pfnImport) + { + osl::Module aLibrary; + aLibrary.loadRelative(&thisModule, "libsotlo.so", SAL_LOADMODULE_LAZY); + pfnImport = reinterpret_cast<FFilterCall>( + aLibrary.getFunctionSymbol("TestImportOLE2")); + aLibrary.release(); + } + SvFileStream aFileStream(out, StreamMode::READ); + ret = (int) (*pfnImport)(aFileStream); } - - /* If AFL_PERSISTENT not set or PERSIST_MAX exceeded, exit normally. */ +#endif } catch (...) { abort(); } - _exit(ret); + return ret; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |