Skip to content

Commit

Permalink
Rollup merge of rust-lang#74984 - RalfJung:miri-unwind-top, r=oli-obk
Browse files Browse the repository at this point in the history
Miri: fix ICE when unwinding past topmost stack frame

Fixes rust-lang/miri#1389
  • Loading branch information
JohnTitor authored Jul 31, 2020
2 parents 5434142 + 73ba4e7 commit bb397c4
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/librustc_mir/interpret/eval_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -718,6 +718,10 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
}
);

if unwinding && self.frame_idx() == 0 {
throw_ub_format!("unwinding past the topmost frame of the stack");
}

::log_settings::settings().indentation -= 1;
let frame =
self.stack_mut().pop().expect("tried to pop a stack frame, but there were none");
Expand Down

0 comments on commit bb397c4

Please sign in to comment.