mirror of
https://github.com/ton-blockchain/ton
synced 2025-03-09 15:40:10 +00:00
Fix undefined behavior code (#464)
* Fix UB in arithmetics * Fix misaligned allocations in validator sessions * Fix integer overflow in bigint.hpp * Fix potential UB Co-authored-by: SpyCheese <mikle98@yandex.ru>
This commit is contained in:
parent
440d06962a
commit
9c6787d2ff
8 changed files with 86 additions and 71 deletions
|
@ -474,7 +474,7 @@ int exec_store_var_integer(VmState* st, int len_bits, bool sgnd, bool quiet) {
|
|||
stack.check_underflow(2);
|
||||
auto x = stack.pop_int();
|
||||
auto cbr = stack.pop_builder();
|
||||
unsigned len = ((x->bit_size(sgnd) + 7) >> 3);
|
||||
unsigned len = (((unsigned)x->bit_size(sgnd) + 7) >> 3);
|
||||
if (len >= (1u << len_bits)) {
|
||||
throw VmError{Excno::range_chk};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue