From d3d17ded9c3d7707ac8a69fde424385465422be0 Mon Sep 17 00:00:00 2001 From: Daniel Silverstone Date: Sun, 26 Apr 2020 15:46:54 +0100 Subject: [PATCH] dukky: Don't allow js_exec on a thread pending destruction Signed-off-by: Daniel Silverstone --- content/handlers/javascript/duktape/dukky.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/content/handlers/javascript/duktape/dukky.c b/content/handlers/javascript/duktape/dukky.c index 7357863cd..6d877129b 100644 --- a/content/handlers/javascript/duktape/dukky.c +++ b/content/handlers/javascript/duktape/dukky.c @@ -925,6 +925,11 @@ js_exec(jsthread *thread, const uint8_t *txt, size_t txtlen, const char *name) return false; } + if (thread->pending_destroy) { + NSLOG(dukky, DEEPDEBUG, "Skipping exec call because thread is dead"); + return false; + } + dukky_enter_thread(thread); duk_set_top(CTX, 0);