mirror of
https://github.com/ton-blockchain/ton
synced 2025-03-09 15:40:10 +00:00
Better error handling in stack serialization (#664)
This commit is contained in:
parent
3a30d6f319
commit
eabcb6a8e9
1 changed files with 20 additions and 14 deletions
|
@ -908,6 +908,7 @@ bool Stack::serialize(vm::CellBuilder& cb, int mode) const {
|
|||
if (vsi && !vsi->register_op()) {
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
// vm_stack#_ depth:(## 24) stack:(VmStackList depth) = VmStack;
|
||||
unsigned n = depth();
|
||||
if (!cb.store_ulong_rchk_bool(n, 24)) { // vm_stack#_ depth:(## 24)
|
||||
|
@ -925,6 +926,11 @@ bool Stack::serialize(vm::CellBuilder& cb, int mode) const {
|
|||
}
|
||||
}
|
||||
return cb.store_ref_bool(std::move(rest)) && stack[n - 1].serialize(cb, mode);
|
||||
} catch (CellBuilder::CellCreateError) {
|
||||
return false;
|
||||
} catch (CellBuilder::CellWriteError) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool Stack::deserialize(vm::CellSlice& cs, int mode) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue