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

oss-fuzz: issue 1188, per-fuzzer config

instead of copying the whole bunch around, now the scheme is to copy
each individual fuzzer and matching config around, so duplicate the
previously shared config for each one an

Change-Id: I479ea13abfab382b6aee23bc04d5f7e535b489c9
üst d176877b
......@@ -20,15 +20,25 @@ export ASAN_OPTIONS="detect_leaks=0"
make fuzzers
#some minimal fonts required
cp $SRC/libreoffice/extras/source/truetype/symbol/opens___.ttf instdir/share/fonts/truetype/Liberation* $OUT
#minimal runtime requirements
rm -rf $OUT/services $OUT/types $OUT/*rdb
mkdir $OUT/services
pushd instdir/program
cp -r *fuzzer unorc fundamentalrc types.rdb types $OUT
head -c -14 services.rdb > $OUT/services.rdb
tail -c +85 ./services/services.rdb >> $OUT/services.rdb
head -c -14 services.rdb > templateservices.rdb
tail -c +85 ./services/services.rdb >> templateservices.rdb
for a in *fuzzer; do
#some minimal fonts required
cp $a $OUT
mkdir -p $OUT/$a.fonts
cp $SRC/libreoffice/extras/source/truetype/symbol/opens___.ttf ../share/fonts/truetype/Liberation* $OUT/$a.fonts
#minimal runtime requirements
cp templateservices.rdb $OUT/$a.services.rdb
cp types.rdb $OUT/$a.types.rdb
cp types/offapi.rdb $OUT/$a.moretypes.rdb
cat > $OUT/$a.unorc << EOF
[Bootstrap]
URE_INTERNAL_LIB_DIR=\${ORIGIN}
UNO_TYPES=\${ORIGIN}/$a.types.rdb \${ORIGIN}/$a.moretypes.rdb
UNO_SERVICES=\${ORIGIN}/$a.services.rdb
EOF
done
popd
#starting corpuses
......
......@@ -49,17 +49,25 @@ namespace
return uri;
}
OUString getExecutableName()
{
OUString uri;
if (osl_getExecutableFile(&uri.pData) != osl_Process_E_None) {
abort();
}
return uri.copy(uri.lastIndexOf('/') + 1);
}
void setFontConfigConf(const OUString &execdir)
{
osl::File aFontConfig("file:///tmp/wmffuzzerfonts.conf");
if (aFontConfig.open(osl_File_OpenFlag_Create | osl_File_OpenFlag_Write) == osl::File::E_None)
{
OUString path;
osl::FileBase::getSystemPathFromFileURL(execdir, path);
OString sFontDir = OUStringToOString(path, osl_getThreadTextEncoding());
OUString sExecDir;
osl::FileBase::getSystemPathFromFileURL(execdir, sExecDir);
rtl::OStringBuffer aBuffer("<?xml version=\"1.0\"?>\n<fontconfig><dir>");
aBuffer.append(sFontDir);
aBuffer.append(OUStringToOString(sExecDir + getExecutableName() + ".fonts", osl_getThreadTextEncoding());
aBuffer.append("</dir><cachedir>/tmp/cache/fontconfig</cachedir></fontconfig>");
rtl::OString aConf = aBuffer.makeStringAndClear();
sal_uInt64 aBytesWritten;
......@@ -104,7 +112,8 @@ void CommonInitialize(int *argc, char ***argv)
tools::extendApplicationEnvironment();
Reference< XComponentContext > xContext = defaultBootstrap_InitialComponentContext();
Reference< XComponentContext > xContext =
defaultBootstrap_InitialComponentContext(sExecDir + getExecutableName() + ".unorc");
Reference< XMultiServiceFactory > xServiceManager( xContext->getServiceManager(), UNO_QUERY );
if( !xServiceManager.is() )
Application::Abort( "Failed to bootstrap" );
......
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