2016-11-02 23:02:17 +00:00
|
|
|
#!/bin/bash -eu
|
|
|
|
# Copyright 2016 Google Inc.
|
|
|
|
#
|
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
# you may not use this file except in compliance with the License.
|
|
|
|
# You may obtain a copy of the License at
|
|
|
|
#
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
#
|
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
# See the License for the specific language governing permissions and
|
|
|
|
# limitations under the License.
|
|
|
|
#
|
|
|
|
################################################################################
|
|
|
|
|
2016-11-02 23:33:21 +00:00
|
|
|
# Fuzzer runner. Appends .options arguments and seed corpus to users args.
|
|
|
|
# Usage: $0 <fuzzer_name> <fuzzer_args>
|
|
|
|
|
2016-11-18 19:16:38 +00:00
|
|
|
cd $OUT
|
|
|
|
export PATH="$OUT:$PATH"
|
2016-11-02 23:02:17 +00:00
|
|
|
|
|
|
|
FUZZER=$1
|
|
|
|
shift
|
|
|
|
CMD_LINE="$FUZZER $@"
|
|
|
|
|
|
|
|
OPTIONS_FILE="${FUZZER}.options"
|
|
|
|
if [ -f $OPTIONS_FILE ]; then
|
|
|
|
OPTIONS_ARGS=$(grep "=" $OPTIONS_FILE | sed 's/\(\w*\)\W*=\W*\(.*\)/-\1=\2 /g' | tr '\n' ' ')
|
|
|
|
CMD_LINE="$CMD_LINE $OPTIONS_ARGS"
|
|
|
|
fi
|
|
|
|
|
2016-11-02 23:22:37 +00:00
|
|
|
SEED_CORPUS="${FUZZER}_seed_corpus.zip"
|
|
|
|
if [ -f $SEED_CORPUS ]; then
|
2016-11-03 00:30:33 +00:00
|
|
|
rm -rf /tmp/seed_corpus/ && mkdir /tmp/seed_corpus/
|
2016-11-02 23:22:37 +00:00
|
|
|
unzip -d /tmp/seed_corpus/ $SEED_CORPUS
|
|
|
|
CMD_LINE="$CMD_LINE /tmp/seed_corpus/"
|
|
|
|
fi
|
|
|
|
|
2016-11-02 23:02:17 +00:00
|
|
|
echo $CMD_LINE
|
|
|
|
bash -c "$CMD_LINE"
|