summary refs log tree commit diff
path: root/tools/cra.sh
diff options
context:
space:
mode:
authorQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2016-04-18 14:13:09 -0400
committerQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2016-04-18 16:21:51 -0400
commit479e946113a38b83307eb7bfee06e948aebf53e9 (patch)
treed4189ec3f0d19346ed83af443e95aa5a86534292 /tools/cra.sh
parentc43a07086bdeefe029c5b6da4ec1c8020126d5ca (diff)
downloadroux-479e946113a38b83307eb7bfee06e948aebf53e9.tar.gz
add tool to process afl results
Diffstat (limited to 'tools/cra.sh')
-rwxr-xr-xtools/cra.sh38
1 files changed, 38 insertions, 0 deletions
diff --git a/tools/cra.sh b/tools/cra.sh
new file mode 100755
index 0000000..762ab76
--- /dev/null
+++ b/tools/cra.sh
@@ -0,0 +1,38 @@
+#!/bin/sh
+
+DIR=`cd $(dirname "$0"); pwd`
+QBE=$DIR/../obj/qbe
+BUGF=/tmp/bug.id
+FIND=$1
+FIND=${FIND:-afl-find}
+
+if ! test -f $BUGF
+then
+	echo 1 > $BUGF
+fi
+
+while true
+do
+	ID=`cat $BUGF`
+
+	if test `ls $FIND/crashes/id* | wc -l` -lt $ID
+	then
+		rm -f bug.ssa
+		echo "All done!"
+		exit 0
+	fi
+
+	BUG=`ls $FIND/crashes/id* | sed -ne "${ID}{p;q}"`
+
+	echo "*** Crash $ID"
+	cp $BUG bug.ssa
+
+	$QBE bug.ssa > /dev/null
+	RET=$?
+	if test \( $RET -ne 0 \) -a \( $RET -ne 1 \)
+	then
+		exit 1
+	fi
+
+	expr $ID + 1 > $BUGF
+done