]> git.lizzy.rs Git - rust.git/commitdiff
Miri: fix ICE when unwinding past topmost stack frame
authorRalf Jung <post@ralfj.de>
Fri, 31 Jul 2020 18:46:05 +0000 (20:46 +0200)
committerRalf Jung <post@ralfj.de>
Fri, 31 Jul 2020 18:46:05 +0000 (20:46 +0200)
src/librustc_mir/interpret/eval_context.rs

index 630b2890835da86feab408c66fd5f9dc2ea3d339..65736710fce1bb1d26ea14275a46ba170ec5c4ea 100644 (file)
@@ -718,6 +718,10 @@ pub(super) fn pop_stack_frame(&mut self, unwinding: bool) -> InterpResult<'tcx>
             }
         );
 
+        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");