Skip to content
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

[SetGlobals] fix segfault #6321

Merged
merged 1 commit into from
Feb 20, 2024
Merged

Conversation

khitrin
Copy link
Contributor

@khitrin khitrin commented Feb 20, 2024

For now if global isn't found, the warning is issued and then the pass segfaults on "if (glob->type == Type::i32)" line because glob is null here (also it is an UB).

This patch replaces warning with Fatal(), preventing segfault and raising an error if global is not found.

I think that the fatal error when the specified global is not found is the preferred (and the current, via segfault) behavior for this pass because it is much safer to break the build than skip SetGlobals without actually setting the variable.

Copy link
Member

@kripken kripken left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@kripken kripken enabled auto-merge (squash) February 20, 2024 19:16
@kripken kripken disabled auto-merge February 20, 2024 20:35
@kripken kripken merged commit a9f01c0 into WebAssembly:main Feb 20, 2024
13 of 14 checks passed
@khitrin khitrin deleted the fix-setglobals-segfault branch February 20, 2024 20:55
radekdoulik pushed a commit to dotnet/binaryen that referenced this pull request Jul 12, 2024
@gkdn gkdn mentioned this pull request Aug 31, 2024
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.

2 participants