From ab2c449585ae457768a8449d877846fe7547f033 Mon Sep 17 00:00:00 2001 From: Renata Hodovan Date: Tue, 23 Jul 2024 19:21:59 +0200 Subject: [PATCH] Ensure not creating a worker with non-existing module Fixes #298. --- quickjs-libc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/quickjs-libc.c b/quickjs-libc.c index 141f79f..40f33cb 100644 --- a/quickjs-libc.c +++ b/quickjs-libc.c @@ -3466,7 +3466,8 @@ static JSValue js_worker_ctor(JSContext *ctx, JSValueConst new_target, /* module name */ filename = JS_ToCString(ctx, argv[0]); - if (!filename) + struct stat buffer; + if (!filename || stat(filename, &buffer) != 0) goto fail; args = malloc(sizeof(*args));