Skip to content

Inlined finally code may run at the wrong context level #22822

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

Closed
DartBot opened this issue Mar 12, 2015 · 1 comment
Closed

Inlined finally code may run at the wrong context level #22822

DartBot opened this issue Mar 12, 2015 · 1 comment
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. P1 A high priority bug; for example, a single project is unusable or has many test failures
Milestone

Comments

@DartBot
Copy link

DartBot commented Mar 12, 2015

This issue was originally filed by @mhausner


This simple program crashes

test(b) {
  try {
    for (int i = 0; i < 10; i++) {
      // Closurizing i and b, thus the return statement
      // executes at context level 2, and the code in
      // the finally block runs at context level 1.
      return () => i + b;
    }
  } finally {
    b = 10;
  }
}

main() {
  var c = test(0);
}

The VM falsely restores the context to the saved try_context before executing the inlined assignment to b. Thus, accessing b accesses a non-existing context and the VM crashes.

Fix is on its way.

@DartBot
Copy link
Author

DartBot commented Mar 13, 2015

This comment was originally written by @mhausner


https://codereview.chromium.org/1006463003/

Fixed in r44465.


Added Fixed label.

@DartBot DartBot added Type-Defect P1 A high priority bug; for example, a single project is unusable or has many test failures area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. labels Mar 13, 2015
@DartBot DartBot added this to the 1.9 milestone Mar 13, 2015
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. P1 A high priority bug; for example, a single project is unusable or has many test failures
Projects
None yet
Development

No branches or pull requests

1 participant