aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2017-10-09 15:10:27 -0700
committerGerald Combs <gerald@wireshark.org>2017-10-09 22:19:39 +0000
commitd72a18faad55d6f47af47acfb9d9270015bad2e2 (patch)
treea9e75e1b22d37bc83c0e2197e6ed45da8ead6456
parent95ce7daf65beb1864cbcb7bd984952eabb0308da (diff)
Fuzz: Limit the number of packets we process with Valgrind.
Estimating the effort required to process a capture based on its size isn't very reliable. Instead of rejecting files that are too large, just limit Valgrind fuzzing to the first 100,000 packets in each file. This should fix a timeout issue we're seeing on the master fuzzer. Change-Id: I0117735341d3a183c6131f5f05dbd1d559fc4b3f Reviewed-on: https://code.wireshark.org/review/23872 Reviewed-by: Gerald Combs <gerald@wireshark.org>
-rwxr-xr-xtools/fuzz-test.sh15
1 files changed, 8 insertions, 7 deletions
diff --git a/tools/fuzz-test.sh b/tools/fuzz-test.sh
index 8d7b2668e9..975a005d62 100755
--- a/tools/fuzz-test.sh
+++ b/tools/fuzz-test.sh
@@ -80,6 +80,8 @@ ws_bind_exec_paths
ws_check_exec "$TSHARK" "$EDITCAP" "$CAPINFOS" "$DATE" "$TMP_DIR"
COMMON_ARGS="${CONFIG_PROFILE}${TWO_PASS}"
+KEEP=
+PACKET_RANGE=
if [ $VALGRIND -eq 1 ]; then
RUNNER="`dirname $0`/valgrind-wireshark.sh"
COMMON_ARGS="-b $WIRESHARK_BIN_DIR $COMMON_ARGS"
@@ -88,6 +90,10 @@ if [ $VALGRIND -eq 1 ]; then
# (1.5x time is too small for a few large captures in the menagerie)
MAX_CPU_TIME=`expr 3 \* $MAX_CPU_TIME`
MAX_VMEM=`expr 3 \* $MAX_VMEM / 2`
+ # Valgrind is slow. Trim captures to the first 100k packets so that
+ # we don't time out.
+ KEEP=-r
+ PACKET_RANGE=1-100000
else
# Not using valgrind, use regular tshark.
# TShark arguments (you won't have to change these)
@@ -180,17 +186,12 @@ while [ \( $PASS -lt $MAX_PASSES -o $MAX_PASSES -lt 1 \) -a $DONE -ne 1 ] ; do
ws_exit_error
fi
- if [ $VALGRIND -eq 1 -a `ls -s $CF | cut -d' ' -f1` -gt 8000 ]; then
- echo "Too big for valgrind"
- continue
- fi
-
DISSECTOR_BUG=0
VG_ERR_CNT=0
- "$EDITCAP" -E $ERR_PROB -o $CHANGE_OFFSET "$CF" $TMP_DIR/$TMP_FILE > /dev/null 2>&1
+ "$EDITCAP" -E $ERR_PROB -o $CHANGE_OFFSET $KEEP "$CF" $TMP_DIR/$TMP_FILE $PACKET_RANGE > /dev/null 2>&1
if [ $? -ne 0 ] ; then
- "$EDITCAP" -E $ERR_PROB -o $CHANGE_OFFSET -T ether "$CF" $TMP_DIR/$TMP_FILE \
+ "$EDITCAP" -E $ERR_PROB -o $CHANGE_OFFSET $KEEP -T ether "$CF" $TMP_DIR/$TMP_FILE $PACKET_RANGE \
> /dev/null 2>&1
if [ $? -ne 0 ] ; then
echo "Invalid format for editcap"