-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
keep referential integrity for file table entries
Before this, some functions such as `uvwasi_path_open()` could crash, because they acquired a reference to a fd table entry using `uvwasi_fd_table_get()` and continued to use the result after calling `uvwasi_fd_table_insert_fd()`; however, the latter could `realloc()` the fd table, potentially invalidating the earlier return value of `uvwasi_fd_table_get()`. Since the previous commit introduced a per-fd allocation anyway, this modifies the code to allocate the table entry itself as part of that allocation. This ensures referential integrity for the table entry. (Aside -- I’m not sure that it was valid to call `uv_mutex_init()` and then move that mutex around in memory, either.)
- Loading branch information
Showing
2 changed files
with
22 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters