From b83dfb1b0636b5d5aa94285b5abd8a268ae570ae Mon Sep 17 00:00:00 2001 From: rswindell <> Date: Tue, 12 Mar 2002 15:30:20 +0000 Subject: [PATCH] js_BranchCallback() now generates JavaScript errors if locally terminated or an infinite loop is detected. --- src/sbbs3/services.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/sbbs3/services.c b/src/sbbs3/services.c index 40008173e3..15a1fa6f7f 100644 --- a/src/sbbs3/services.c +++ b/src/sbbs3/services.c @@ -568,14 +568,13 @@ js_BranchCallback(JSContext *cx, JSScript *script) /* Terminated? */ if(terminated) { - lprintf("%04d %s !Terminated" - ,client->socket,client->service->protocol); + JS_ReportError(cx,"Terminated"); + client->js_loop=0; return(JS_FALSE); } - /* Infinite loop detection */ + /* Infinite loop? */ if(client->js_loop>JAVASCRIPT_BRANCH_LIMIT) { - lprintf("%04d %s !INFINITE LOOOP (%lu branches) detected" - ,client->socket,client->service->protocol,JAVASCRIPT_BRANCH_LIMIT); + JS_ReportError(cx,"Infinite loop (%lu branches) detected",client->js_loop); client->js_loop=0; return(JS_FALSE); } -- GitLab