about summary refs log tree commit diff
path: root/src/afl-showmap.c
diff options
context:
space:
mode:
authorvanhauser-thc <vh@thc.org>2021-10-23 20:54:24 +0200
committervanhauser-thc <vh@thc.org>2021-10-23 20:54:24 +0200
commite03897a0703673aa0de7772185a5b5230641cb6a (patch)
tree6a7137d56fa0dd743fed4be96f7a1bc91354f158 /src/afl-showmap.c
parent06b23c7dcba0738266e85609f3fcadeb7c1b3560 (diff)
downloadafl++-e03897a0703673aa0de7772185a5b5230641cb6a.tar.gz
fix timeout bug in afl tools
Diffstat (limited to 'src/afl-showmap.c')
-rw-r--r--src/afl-showmap.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/afl-showmap.c b/src/afl-showmap.c
index 5df07bf2..3a244c04 100644
--- a/src/afl-showmap.c
+++ b/src/afl-showmap.c
@@ -146,6 +146,17 @@ static const u8 count_class_binary[256] = {
 #undef TIMES8
 #undef TIMES4
 
+static void kill_child() {
+
+  if (fsrv->child_pid > 0) {
+
+    kill(fsrv->child_pid, fsrv->kill_signal);
+    fsrv->child_pid = -1;
+
+  }
+
+}
+
 static void classify_counts(afl_forkserver_t *fsrv) {
 
   u8 *      mem = fsrv->trace_bits;
@@ -526,6 +537,8 @@ static void showmap_run_target(afl_forkserver_t *fsrv, char **argv) {
 
   }
 
+  signal(SIGALRM, kill_child);
+
   setitimer(ITIMER_REAL, &it, NULL);
 
   if (waitpid(fsrv->child_pid, &status, 0) <= 0) { FATAL("waitpid() failed"); }