Skip to content

Commit

Permalink
oss-fuzz/build.sh: move flags to 'set' from #! (#2037)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jzern authored Feb 23, 2024
1 parent 55bfa73 commit a44270e
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions tests/oss-fuzz/build.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash -eu
#!/bin/bash
# Copyright 2020 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -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" ]
Expand Down Expand Up @@ -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

0 comments on commit a44270e

Please sign in to comment.