Skip to content

Commit 55f9f92

Browse files
committed
Fixes an uninitialized variable in extra wasmfs/fetchfs feature
Under some optimizations, this would lead to games using fetchfs backend just crashing due to calling wasmfs functions on a garbage pointer.
1 parent 547d739 commit 55f9f92

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

frontend/drivers/platform_emscripten.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -628,14 +628,18 @@ static void platform_emscripten_mount_filesystems(void)
628628
char *base_url = strdup(line);
629629
base_url[strcspn(base_url, "\r\n")] = '\0'; // drop newline
630630
base_url[len-1] = '\0'; // drop newline
631-
backend_t fetch;
631+
backend_t fetch = NULL;
632632
len = max_line_len;
633633
// Don't create fetch backend unless manifest actually has entries
634634
while (getline(&line, &len, file) != -1)
635635
{
636636
if (!fetch)
637637
{
638638
fetch = wasmfs_create_fetch_backend(base_url, 16*1024*1024);
639+
if(!fetch) {
640+
printf("[FetchFS] couldn't create fetch backend for %s\n", base_url);
641+
abort();
642+
}
639643
wasmfs_create_directory(fetch_base_dir, 0777, fetch);
640644
}
641645
char *realfs_path = strstr(line, " "), *url = line;

0 commit comments

Comments
 (0)