diff options
author | Dario Lombardo <lomato@gmail.com> | 2015-08-11 23:58:54 +0200 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2015-08-12 21:23:30 +0000 |
commit | 0b7d1611d05688536992ae47962fda079c601207 (patch) | |
tree | 24acd238d4b290ac447cc4846d58d394ce099bde /tools/fuzz-test.sh | |
parent | 99e3244324e3a39832b5c0c26eeb259dd42deb2e (diff) |
editcap: add change offset.
This option skips some bytes when fuzzing, that prevents some headers from being changed. This focuses fuzzer to a smaller part of the packet.
Change-Id: I1db83235e93f2774a9991e3af70f633487b816fa
Reviewed-on: https://code.wireshark.org/review/9982
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'tools/fuzz-test.sh')
-rwxr-xr-x | tools/fuzz-test.sh | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/tools/fuzz-test.sh b/tools/fuzz-test.sh index b2788b107b..0e535aa51c 100755 --- a/tools/fuzz-test.sh +++ b/tools/fuzz-test.sh @@ -48,13 +48,16 @@ VALGRIND=0 # Run under AddressSanitizer ? ASAN=0 +# Don't skip any byte from being changed +CHANGE_OFFSET=0 + # The maximum permitted amount of memory leaked. Eventually this should be # worked down to zero, but right now that would fail on every single capture. # Only has effect when running under valgrind. MAX_LEAK=`expr 1024 \* 100` # To do: add options for file names and limits -while getopts "2b:C:d:e:agp:P:" OPTCHAR ; do +while getopts "2b:C:d:e:agp:P:o:" OPTCHAR ; do case $OPTCHAR in a) ASAN=1 ;; 2) TWO_PASS="-2 " ;; @@ -65,6 +68,7 @@ while getopts "2b:C:d:e:agp:P:" OPTCHAR ; do g) VALGRIND=1 ;; p) MAX_PASSES=$OPTARG ;; P) MIN_PLUGINS=$OPTARG ;; + o) CHANGE_OFFSET=$OPTARG ;; esac done shift $(($OPTIND - 1)) @@ -176,9 +180,9 @@ while [ \( $PASS -lt $MAX_PASSES -o $MAX_PASSES -lt 1 \) -a $DONE -ne 1 ] ; do DISSECTOR_BUG=0 VG_ERR_CNT=0 - "$EDITCAP" -E $ERR_PROB "$CF" $TMP_DIR/$TMP_FILE > /dev/null 2>&1 + "$EDITCAP" -E $ERR_PROB -o $CHANGE_OFFSET "$CF" $TMP_DIR/$TMP_FILE > /dev/null 2>&1 if [ $? -ne 0 ] ; then - "$EDITCAP" -E $ERR_PROB -T ether "$CF" $TMP_DIR/$TMP_FILE \ + "$EDITCAP" -E $ERR_PROB -o $CHANGE_OFFSET -T ether "$CF" $TMP_DIR/$TMP_FILE \ > /dev/null 2>&1 if [ $? -ne 0 ] ; then echo "Invalid format for editcap" |