Ensure not creating a worker with non-existing module

Fixes #298.
This commit is contained in:
Renata Hodovan 2024-07-23 19:21:59 +02:00
parent 012451d5f3
commit ab2c449585

View File

@ -3466,7 +3466,8 @@ static JSValue js_worker_ctor(JSContext *ctx, JSValueConst new_target,
/* module name */ /* module name */
filename = JS_ToCString(ctx, argv[0]); filename = JS_ToCString(ctx, argv[0]);
if (!filename) struct stat buffer;
if (!filename || stat(filename, &buffer) != 0)
goto fail; goto fail;
args = malloc(sizeof(*args)); args = malloc(sizeof(*args));