[rnp] Generate input corpus (#4322)

This commit is contained in:
Tom Ritter 2020-08-14 12:53:56 -05:00 committed by GitHub
parent 929dc5e247
commit 3d5478c653
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 1 deletions

View File

@ -15,6 +15,8 @@
# #
################################################################################ ################################################################################
ORIG_DIR=$(pwd)
wget -qO- https://botan.randombit.net/releases/Botan-2.12.1.tar.xz | tar xvJ wget -qO- https://botan.randombit.net/releases/Botan-2.12.1.tar.xz | tar xvJ
cd Botan-2.12.1 cd Botan-2.12.1
./configure.py --prefix=/usr --cc-bin=$CXX --cc-abi-flags="$CXXFLAGS" \ ./configure.py --prefix=/usr --cc-bin=$CXX --cc-abi-flags="$CXXFLAGS" \
@ -23,7 +25,14 @@ cd Botan-2.12.1
--with-fuzzer-lib='FuzzingEngine' --with-fuzzer-lib='FuzzingEngine'
make make
make install make install
cd ..
cd $ORIG_DIR
mkdir fuzzing_corpus
cd rnp/src/tests/data
find . -type f -print0 | xargs -0 -I bob -- cp bob $ORIG_DIR/fuzzing_corpus/
cd $ORIG_DIR
# -DENABLE_SANITIZERS=0 because oss-fuzz will add the sanitizer flags in CFLAGS # -DENABLE_SANITIZERS=0 because oss-fuzz will add the sanitizer flags in CFLAGS
# See https://github.com/google/oss-fuzz/pull/4189 to explain CMAKE_C_LINK_EXECUTABLE # See https://github.com/google/oss-fuzz/pull/4189 to explain CMAKE_C_LINK_EXECUTABLE
@ -47,6 +56,7 @@ FUZZERS="fuzz_dump fuzz_keyring"
for f in $FUZZERS; do for f in $FUZZERS; do
cp src/fuzzing/$f "${OUT}/" cp src/fuzzing/$f "${OUT}/"
chrpath -r '$ORIGIN/lib' "${OUT}/$f" chrpath -r '$ORIGIN/lib' "${OUT}/$f"
zip -j -r "${OUT}/${f}_seed_corpus.zip" $ORIG_DIR/fuzzing_corpus/
done done
mkdir -p "${OUT}/lib" mkdir -p "${OUT}/lib"