Kaydet (Commit) aa3c2526 authored tarafından Caolán McNamara's avatar Caolán McNamara

oss-fuzz: drop our own afl related hackery

Change-Id: Ia6a498c07fffd1790ad433287ef4d1cf82085887
Reviewed-on: https://gerrit.libreoffice.org/43695Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 7b2f4b32
...@@ -155,11 +155,6 @@ class Desktop : public Application ...@@ -155,11 +155,6 @@ class Desktop : public Application
*/ */
void CheckFirstRun( ); void CheckFirstRun( );
/** for ui-testing provide a mechanism to pseudo-restart by closing the
open frames and reopen the frame that appeared post initial startup
*/
static void DoExecute();
static void ShowBackingComponent(Desktop * progress); static void ShowBackingComponent(Desktop * progress);
// on-demand acceptors // on-demand acceptors
......
...@@ -1255,23 +1255,6 @@ struct ExecuteGlobals ...@@ -1255,23 +1255,6 @@ struct ExecuteGlobals
static ExecuteGlobals* pExecGlobals = nullptr; static ExecuteGlobals* pExecGlobals = nullptr;
//This just calls Execute() for all normal uses of LibreOffice, but for
//ui-testing if built with afl-clang-fast++ then on exit it will pseudo-restart
//(up to 100 times)
void Desktop::DoExecute()
{
#if !defined(__AFL_HAVE_MANUAL_CONTROL)
Execute();
#else
while (__AFL_LOOP(1000))
{
Execute();
OpenDefault();
}
#endif
}
int Desktop::Main() int Desktop::Main()
{ {
pExecGlobals = new ExecuteGlobals(); pExecGlobals = new ExecuteGlobals();
...@@ -1663,7 +1646,7 @@ int Desktop::Main() ...@@ -1663,7 +1646,7 @@ int Desktop::Main()
// if this run of the office is triggered by restart, some additional actions should be done // if this run of the office is triggered by restart, some additional actions should be done
DoRestartActionsIfNecessary( !rCmdLineArgs.IsInvisible() && !rCmdLineArgs.IsNoQuickstart() ); DoRestartActionsIfNecessary( !rCmdLineArgs.IsInvisible() && !rCmdLineArgs.IsNoQuickstart() );
DoExecute(); Execute();
} }
} }
catch(const css::document::CorruptedFilterConfigurationException& exFilterCfg) catch(const css::document::CorruptedFilterConfigurationException& exFilterCfg)
......
...@@ -18,18 +18,9 @@ ...@@ -18,18 +18,9 @@
*/ */
/* e.g. /* e.g.
export CC=afl-clang-fast
export CXX=afl-clang-fast++
make make
cp workdir/LinkTarget/Executable/fftester instdir/program 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 LD_LIBRARY_PATH=`pwd`/instdir/program instdir/program/fftester <foo> 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)
*/ */
#include <sal/main.h> #include <sal/main.h>
...@@ -50,8 +41,6 @@ ...@@ -50,8 +41,6 @@
#include <vcl/wrkwin.hxx> #include <vcl/wrkwin.hxx>
#include <vcl/fltcall.hxx> #include <vcl/fltcall.hxx>
#include <osl/file.hxx> #include <osl/file.hxx>
#include <unistd.h>
#include <signal.h>
#include <../source/filter/igif/gifread.hxx> #include <../source/filter/igif/gifread.hxx>
#include <../source/filter/ixbm/xbmread.hxx> #include <../source/filter/ixbm/xbmread.hxx>
...@@ -69,13 +58,6 @@ extern "C" { static void SAL_CALL thisModule() {} } ...@@ -69,13 +58,6 @@ extern "C" { static void SAL_CALL thisModule() {} }
typedef bool (*WFilterCall)(const OUString &rUrl); typedef bool (*WFilterCall)(const OUString &rUrl);
typedef bool (*FFilterCall)(SvStream &rStream); 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) SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
{ {
int ret = -1; int ret = -1;
...@@ -109,9 +91,6 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) ...@@ -109,9 +91,6 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
utl::ConfigManager::EnableAvoidConfig(); utl::ConfigManager::EnableAvoidConfig();
InitVCL(); 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; GDIMetaFile aGDIMetaFile;
...@@ -564,26 +543,12 @@ try_again: ...@@ -564,26 +543,12 @@ try_again:
} }
#endif #endif
} }
/* 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)
{
raise(SIGSTOP);
goto try_again;
}
/* If AFL_PERSISTENT not set or PERSIST_MAX exceeded, exit normally. */
}
catch (...) catch (...)
{ {
abort(); abort();
} }
_exit(ret); return ret;
} }
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment