From a44270e713aacaf8cea5a7820dbaaf9128908941 Mon Sep 17 00:00:00 2001 From: James Zern Date: Fri, 23 Feb 2024 13:38:34 -0800 Subject: [PATCH] oss-fuzz/build.sh: move flags to 'set' from #! (#2037) The set command is preferred over flags in the shebang because they won't be used if the script is invoked with bash as is done in the oss-fuzz project's build.sh. The zip creation is updated to avoid using cp as there are subdirectories in the tests/data folder which cause failures when not using -r. --- tests/oss-fuzz/build.sh | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/tests/oss-fuzz/build.sh b/tests/oss-fuzz/build.sh index 657e7b8f0d..36e627802f 100755 --- a/tests/oss-fuzz/build.sh +++ b/tests/oss-fuzz/build.sh @@ -1,4 +1,4 @@ -#!/bin/bash -eu +#!/bin/bash # Copyright 2020 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -36,6 +36,8 @@ # avif_fuzztest_enc_dec_incr@EncodeDecodeAvifFuzzTest.EncodeDecodeGridValid \ # --sanitizer address +set -eu + # Build dav1d with sanitizer flags. # Adds extra flags: -Db_sanitize=$SANITIZER -Db_lundef=false, and -Denable_asm=false for msan if [ "$SANITIZER" != "coverage" ] && [ "$SANITIZER" != "introspector" ] @@ -123,10 +125,9 @@ chmod -x \$this_dir/$fuzz_basename" > $OUT/$TARGET_FUZZER done fi -# copy seed corpus for fuzztest tests -mkdir $OUT/corpus -unzip $SRC/avif_decode_seed_corpus.zip -d $OUT/corpus -cp $SRC/libavif/tests/data/* $OUT/corpus - # create a bigger seed corpus for avif_decode_fuzzer -zip -j $OUT/avif_decode_fuzzer_seed_corpus.zip $OUT/corpus/* +cp $SRC/avif_decode_seed_corpus.zip $OUT/avif_decode_fuzzer_seed_corpus.zip +zip -j $OUT/avif_decode_fuzzer_seed_corpus.zip \ + $(find $SRC/libavif/tests/data -maxdepth 1 -type f) +# copy seed corpus for fuzztest tests +unzip $OUT/avif_decode_fuzzer_seed_corpus.zip -d $OUT/corpus