mirror of
https://github.com/vsariola/sointu.git
synced 2025-07-18 21:14:31 -04:00
fix(vm/compiler/templates): modulating delaytime in wasm could crash
The modulated delay time was converted to int with i32.trunc_f32_u. This throws runtime error if the modulations caused the delaytime to become negative, because _u implied that it should be unsigned integer and negative numbers were out of range. Using i32.trunc_f32_s fixed this.
This commit is contained in:
parent
f074c392f6
commit
4a8d4c5a29
@ -313,7 +313,7 @@
|
||||
))
|
||||
{{- end}}
|
||||
{{- if .SupportsModulation "delay" "delaytime"}}
|
||||
(i32.trunc_f32_u (f32.add
|
||||
(i32.trunc_f32_s (f32.add
|
||||
(f32.add
|
||||
(local.get $delayTime)
|
||||
(f32.mul
|
||||
@ -324,7 +324,7 @@
|
||||
(f32.const 0.5)
|
||||
))
|
||||
{{- else}}
|
||||
(i32.trunc_f32_u (f32.add (local.get $delayTime) (f32.const 0.5)))
|
||||
(i32.trunc_f32_s (f32.add (local.get $delayTime) (f32.const 0.5)))
|
||||
{{- end}}
|
||||
{{- else}}
|
||||
(i32.load16_u
|
||||
|
Reference in New Issue
Block a user