Mark Wielaard defd97
index 389748960..07f3400f9 100644
Mark Wielaard defd97
--- a/coregrind/vgdb-invoker-ptrace.c
Mark Wielaard defd97
+++ b/coregrind/vgdb-invoker-ptrace.c
Mark Wielaard defd97
@@ -300,6 +300,10 @@ Bool waitstopped (pid_t pid, int signal_expected, const char *msg)
Mark Wielaard defd97
 
Mark Wielaard defd97
          // realloc a bigger queue, and store new signal at the end.
Mark Wielaard defd97
          // This is not very efficient but we assume not many sigs are queued.
Mark Wielaard defd97
+         if (signal_queue_sz >= 64) {
Mark Wielaard defd97
+            DEBUG(0, "too many queued signals while waiting for SIGSTOP\n");
Mark Wielaard defd97
+            return False;
Mark Wielaard defd97
+         }
Mark Wielaard defd97
          signal_queue_sz++;
Mark Wielaard defd97
          signal_queue = vrealloc(signal_queue,
Mark Wielaard defd97
                                  sizeof(siginfo_t) * signal_queue_sz);
Mark Wielaard defd97