mirror of
https://github.com/pezkuwichain/wasm-instrument.git
synced 2026-04-27 15:17:56 +00:00
19760b5835
The code assumed that the number of `Local` and number of locals is the same thing. In reality though it is not. `Local` actually represents a group of locals with the same type. The group can declare more than one variable and the number of them is returned by `Local::count`. In this PR we acknowledge this fact. Along the way we add a checked arithmetic for locals_count and max_stack_height summation.
22 lines
376 B
WebAssembly Text Format
22 lines
376 B
WebAssembly Text Format
(module
|
|
(type (;0;) (func))
|
|
(func (;0;) (type 0)
|
|
(local i64 i64 i32))
|
|
(func (;1;) (type 0)
|
|
global.get 0
|
|
i32.const 3
|
|
i32.add
|
|
global.set 0
|
|
global.get 0
|
|
i32.const 1024
|
|
i32.gt_u
|
|
if ;; label = @1
|
|
unreachable
|
|
end
|
|
call 0
|
|
global.get 0
|
|
i32.const 3
|
|
i32.sub
|
|
global.set 0)
|
|
(global (;0;) (mut i32) (i32.const 0)))
|