Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Fix jsFS callback-related crashes #1118

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

samhocevar
Copy link
Contributor

The first fix is also present upstream: see js_fs.go. According to the comment, it is here because Node.js 8 fs.utimes() can call the callback without arguments.

The first fix also protects against the BrowserFS project’s almost 50 code locations where a callback is called without arguments:

The second commit is an additional safety against the callback argument being undefined instead of null. Again, this happens in the BrowserFS project: FS.close() creates a callback that passes its argument to the GopherJS-provided callback, however since the underlying NoSyncFile.close() calls cb() instead of cb(null), this becomes undefined back in GopherJS’s fsCall() and the call to mapJSError() will throw.

@nevkontakte
Copy link
Member

Hehe, I distinctly remember not including this fix into our overlays because there's no way anyone would be using Node 8 these days. Oh well :)

Could you please add a brief comment to the if condition about BrowserFS and referencing this PR? Git blame gets difficult to trace after a while and overlay code tends to get updated fairly regularly. Other than that, this change looks good to me.

@samhocevar
Copy link
Contributor Author

I added an explanatory comment to the code section.

@nevkontakte nevkontakte merged commit 1497816 into gopherjs:master May 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.