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

[Merged by Bors] - Correct pop_on_return behaviour #1853

Closed

Conversation

addisoncrump
Copy link
Contributor

This PR changes the following:

  • Updates the value of pop_on_return after a catch as to prevent VM stack corruption
  • Adds two test cases which demonstrate the issue and demonstrate that it has been fixed

I am unsure if it is possible to abuse the patch provided; one would need to catch from within an array initialisation without calling into another frame (e.g., with a lambda), which I don't think is possible.

@codecov
Copy link

codecov bot commented Feb 21, 2022

Codecov Report

Merging #1853 (5253669) into main (8c92a8f) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #1853   +/-   ##
=======================================
  Coverage   56.29%   56.30%           
=======================================
  Files         201      201           
  Lines       17936    17937    +1     
=======================================
+ Hits        10097    10099    +2     
+ Misses       7839     7838    -1     
Impacted Files Coverage Δ
boa_engine/src/vm/mod.rs 78.36% <100.00%> (+0.17%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8c92a8f...5253669. Read the comment docs.

Copy link
Member

@RageKnify RageKnify left a comment

Choose a reason for hiding this comment

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

Feels weird to not check anything after executing the JS code. We could at least check whether an exception was thrown, in the first case the result of exec should be Err and in the second case Ok, right? Just asserting that they got the right variants feels better than doing nothing else.

@addisoncrump
Copy link
Contributor Author

Sorry for the late response on this; busy Monday. :) Do the changes provided suffice?

Copy link
Member

@jedel1043 jedel1043 left a comment

Choose a reason for hiding this comment

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

Looks good!

Copy link
Member

@RageKnify RageKnify left a comment

Choose a reason for hiding this comment

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

bors r+

bors bot pushed a commit that referenced this pull request Feb 23, 2022
This PR changes the following:

- Updates the value of `pop_on_return` after a catch as to prevent VM stack corruption
- Adds two test cases which demonstrate the issue and demonstrate that it has been fixed

I am unsure if it is possible to abuse the patch provided; one would need to catch from within an array initialisation without calling into another frame (e.g., with a lambda), which I don't think is possible.
@bors
Copy link

bors bot commented Feb 23, 2022

Pull request successfully merged into main.

Build succeeded:

@bors bors bot changed the title Correct pop_on_return behaviour [Merged by Bors] - Correct pop_on_return behaviour Feb 23, 2022
@bors bors bot closed this Feb 23, 2022
@Razican Razican added this to the v0.14.0 milestone Feb 23, 2022
@Razican Razican added bug Something isn't working vm Issues and PRs related to the Boa Virtual Machine. labels Feb 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working vm Issues and PRs related to the Boa Virtual Machine.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants