-
Notifications
You must be signed in to change notification settings - Fork 820
Fuzzer: Fix (remove) invalid try-delegates #7978
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
Conversation
|
Btw, I did this from memory - I wasn't sure where to find the spec for delegates, now it isn't in the proposal? |
src/tools/fuzzing/fuzzing.cpp
Outdated
| if (i + 1 >= expressionStack.size()) { | ||
| return false; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know it's preexisting, but is this necessary, given that we start i from expressionStack.size() - 2 above? If not, can we remove it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. I turned it into an assert.
| if (curr->is<Rethrow>()) { | ||
| return child != tryy->body; | ||
| } | ||
| assert(curr->is<Try>()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here curr (I guess accidentally) means the overwritten curr in line 2174, and because we have line 2175, isn't this always true?
while (1) {
auto* curr = expressionStack[i];
if (auto* tryy = curr->dynCast<Try>()) {
...
assert(curr->is<Try>());There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this was wrong, good catch. Fixed.
src/tools/fuzzing/fuzzing.cpp
Outdated
| Index i = expressionStack.size() - 2; | ||
| // Rethrows and try-delegates must target a try. Find it. | ||
| while (1) { | ||
| auto* curr = expressionStack[i]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This curr now overwrites the function parameter curr, which can be confusing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, yeah, that looked wrong. I removed the loop var.
https://webassembly.github.io/spec/ in the "Legacy Extensions" section. |
|
Thanks, good to know about the legacy section! |
We already did this for Rethrow, and Try with delegate is almost the same.