diff options
author | Gerald Combs <gerald@wireshark.org> | 2005-10-11 15:17:06 +0000 |
---|---|---|
committer | Gerald Combs <gerald@wireshark.org> | 2005-10-11 15:17:06 +0000 |
commit | 25d75e66a7b3a47995d601e7a0c6c434ecaf444e (patch) | |
tree | f1192ef5564ad35ec4496ab6d91ee122dc1d345e /tools/fuzz-test.sh | |
parent | 1cfe020e5b38f29066b20f5713c5482f11461f1c (diff) |
Set ETHEREAL_ABORT_ON_DISSECTOR_BUG. Make sure we create a core file. Fix
up file names and extensions.
svn path=/trunk/; revision=16190
Diffstat (limited to 'tools/fuzz-test.sh')
-rwxr-xr-x | tools/fuzz-test.sh | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/tools/fuzz-test.sh b/tools/fuzz-test.sh index 1d8b05330e..dd2221c6cf 100755 --- a/tools/fuzz-test.sh +++ b/tools/fuzz-test.sh @@ -17,9 +17,11 @@ CAPINFOS=./capinfos # This needs to point to a 'date' that supports %s. DATE=/bin/date -# Where our temp files are saved (editcap.out and stderr.out) +# Temporary file directory and names. # (had problems with this on cygwin, tried TMP_DIR=./ which worked) TMP_DIR=/tmp +TMP_FILE=fuzz-test.pcap +ERR_FILE=fuzz-err.txt # These may be set to your liking # Stop the child process, if it's running longer than x seconds @@ -28,10 +30,14 @@ MAX_CPU_TIME=900 MAX_VMEM=500000 # Insert z times an error into the capture file (0.02 seems to be a good value to find errors) ERR_PROB=0.02 +# Trigger an abort if a dissector finds a bug. +# Uncomment to disable +ETHEREAL_ABORT_ON_DISSECTOR_BUG="True" # set some limits to the child processes, e.g. stop it if it's running longer then MAX_CPU_TIME seconds # (ulimit is not supported well on cygwin and probably other platforms, e.g. cygwin shows some warnings) ulimit -S -t $MAX_CPU_TIME -v $MAX_VMEM +ulimit -c unlimited ### usually you won't have to change anything below this line ### @@ -89,29 +95,30 @@ while [ 1 ] ; do DISSECTOR_BUG=0 - "$EDITCAP" -E $ERR_PROB "$CF" $TMP_DIR/editcap.out > /dev/null 2>&1 + "$EDITCAP" -E $ERR_PROB "$CF" $TMP_DIR/$TMP_FILE > /dev/null 2>&1 if [ $? -ne 0 ] ; then - "$EDITCAP" -E $ERR_PROB -T ether "$CF" $TMP_DIR/editcap.out > /dev/null 2>&1 + "$EDITCAP" -E $ERR_PROB -T ether "$CF" $TMP_DIR/$TMP_FILE \ + > /dev/null 2>&1 if [ $? -ne 0 ] ; then echo "Invalid format for editcap" continue fi fi - "$TETHEREAL" $TETHEREAL_ARGS $TMP_DIR/editcap.out \ - > /dev/null 2> $TMP_DIR/stderr.out + "$TETHEREAL" $TETHEREAL_ARGS $TMP_DIR/$TMP_FILE \ + > /dev/null 2> $TMP_DIR/$ERR_FILE RETVAL=$? - grep -i "dissector bug" $TMP_DIR/stderr.out \ + grep -i "dissector bug" $TMP_DIR/$ERR_FILE \ > /dev/null 2>&1 && DISSECTOR_BUG=1 if [ $RETVAL -ne 0 -o $DISSECTOR_BUG -ne 0 ] ; then - SUF=`$DATE +%s` + FUZZ_FILE="fuzz-`$DATE +%Y-%m-%d`-$$.pcap" echo " ERROR" echo -e "Processing failed. Capture info follows:\n" - mv $TMP_DIR/editcap.out $TMP_DIR/editcap.out.$SUF - echo " Output file: $TMP_DIR/editcap.out.$SUF" + mv $TMP_DIR/$TMP_FILE $TMP_DIR/$FUZZ_FILE + echo " Output file: $TMP_DIR/$FUZZ_FILE" if [ $DISSECTOR_BUG -ne 0 ] ; then echo -e "stderr follows:\n" - cat $TMP_DIR/stderr.out + cat $TMP_DIR/$ERR_FILE fi exit 1 fi |