1
0
Fork 0
mirror of https://github.com/ton-blockchain/ton synced 2025-03-09 15:40:10 +00:00

fix(vm): fix saving ret on deep jump (#1487)

This commit is contained in:
Ivan Kalinin 2025-01-24 15:41:43 +01:00 committed by GitHub
parent fe46f0e238
commit 0f6cf13d45
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 16 additions and 2 deletions

View file

@ -347,6 +347,7 @@ class VmState final : public VmStateInterface {
int call(Ref<Continuation> cont, int pass_args, int ret_args = -1);
int jump(Ref<Continuation> cont);
int jump(Ref<Continuation> cont, int pass_args);
Ref<Continuation> adjust_jump_cont(Ref<Continuation> cont, int pass_args);
int ret();
int ret(int ret_args);
int ret_alt();
@ -374,6 +375,14 @@ class VmState final : public VmStateInterface {
if (cnt > free_nested_cont_jump && global_version >= 9) {
consume_gas(1);
}
if (cont.not_null()) {
const ControlData* cont_data = cont->get_cdata();
if (cont_data && (cont_data->stack.not_null() || cont_data->nargs >= 0)) {
// if cont has non-empty stack or expects fixed number of arguments, jump is not simple
cont = adjust_jump_cont(std::move(cont), -1);
}
}
}
return res;
}