From 61302673d5870dc3eae32ba0e1c60d2d9f6aef21 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Fri, 6 Feb 2015 23:20:11 -0800 Subject: * unwind.c (uw_throw): Detect invalid re-entry and bail. Cautiously, we use fprintf rather than our streams system, in case some problem with the streams is involved in this mess. --- unwind.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'unwind.c') diff --git a/unwind.c b/unwind.c index 7e35c937..5d358e42 100644 --- a/unwind.c +++ b/unwind.c @@ -260,6 +260,12 @@ val uw_exception_subtype_p(val sub, val sup) val uw_throw(val sym, val args) { uw_frame_t *ex; + static int reentry_count = 0; + + if (++reentry_count > 1) { + fprintf(stderr, "txr: invalid re-entry of exception handling logic\n"); + abort(); + } if (!listp(args)) args = cons(args, nil); @@ -334,6 +340,7 @@ val uw_throw(val sym, val args) ex->ca.sym = sym; ex->ca.args = args; uw_exit_point = ex; + reentry_count--; uw_unwind_to_exit_point(); abort(); } -- cgit v1.2.3