Skip to content

Commit 43cb4eb

Browse files
authored
[bella-ciao] Check that call stack is empty when returning from from eval::run (#24424)
## Description When `eval::run` returns there should be no remaining call frames on the call stack. Check this and return an error if any frames remain. ## Test plan CI --- ## Release notes Check each box that your changes affect. If none of the boxes relate to your changes, release notes aren't required. For each box you select, include information after the relevant heading that describes the impact of your changes that a user might notice and any actions they must take to implement updates. - [ ] Protocol: - [ ] Nodes (Validators and Full nodes): - [ ] gRPC: - [ ] JSON-RPC: - [ ] GraphQL: - [ ] CLI: - [ ] Rust SDK: - [ ] Indexing Framework:
1 parent 5f119ac commit 43cb4eb

File tree

1 file changed

+10
-3
lines changed
  • external-crates/move/crates/move-vm-runtime/src/execution/interpreter

1 file changed

+10
-3
lines changed

external-crates/move/crates/move-vm-runtime/src/execution/interpreter/eval.rs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,16 @@ pub(super) fn run(
112112
} = call_stack;
113113
heap.free_stack_frame(current_frame.stack_frame)
114114
.map_err(|e| e.finish(Location::Undefined))?;
115-
for frame in frames.into_iter().rev() {
116-
heap.free_stack_frame(frame.stack_frame)
117-
.map_err(|e| e.finish(Location::Undefined))?;
115+
debug_assert!(
116+
frames.is_empty(),
117+
"Call stack should be empty after execution"
118+
);
119+
if !frames.is_empty() {
120+
return Err(
121+
PartialVMError::new(StatusCode::UNKNOWN_INVARIANT_VIOLATION_ERROR)
122+
.with_message("Call stack should be empty after execution".to_owned())
123+
.finish(Location::Undefined),
124+
);
118125
}
119126
Ok(operand_stack.value)
120127
}

0 commit comments

Comments
 (0)