lua: fix .dict and .options filenames (#11721)

OSS Fuzz documentation says that default name of dictionary file is the
same as fuzzer filename:

> If the dict filename is the same as your target binary name
> (i.e. `%fuzz_target%.dict`), it will be automatically used.

The patch fixes `build.sh` accordingly.
This commit is contained in:
Sergey Bronnikov 2024-03-23 23:51:36 +03:00 committed by GitHub
parent 3659b194b9
commit 9613e6f8aa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 5 deletions

View File

@ -98,7 +98,11 @@ LUALIB_PATH="$SRC/testdir/build/lua-master/source/"
$CC $CFLAGS -I$LUALIB_PATH -c $SRC/fuzz_lua.c -o fuzz_lua.o
$CXX $CXXFLAGS $LIB_FUZZING_ENGINE fuzz_lua.o -o $OUT/fuzz_lua $LUALIB_PATH/liblua.a
cp corpus_dir/*.options $OUT/
# If the dict filename is the same as your target binary name
# (i.e. `%fuzz_target%.dict`), it will be automatically used.
# If the name is different (e.g. because it is shared by several
# targets), specify this in .options file.
cp corpus_dir/*.dict corpus_dir/*.options $OUT/
# Archive and copy to $OUT seed corpus if the build succeeded.
for f in $(find build/tests/ -name '*_test' -type f);
@ -108,9 +112,5 @@ do
corpus_dir="corpus_dir/$module"
echo "Copying for $module";
cp $f $OUT/
dict_path="corpus_dir/$module.dict"
if [ -e "$dict_path" ]; then
cp $dict_path "$OUT/$name.dict"
fi
[[ -e $corpus_dir ]] && find "$corpus_dir" -mindepth 1 -maxdepth 1 | zip -@ -j $OUT/"$name"_seed_corpus.zip
done