Skip to content

Commit 4e80a93

Browse files
committed
[interpreter] Fix crashes on try_table with parameters
The test case was ported from toywasm.
1 parent cfb909d commit 4e80a93

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

interpreter/exec/eval.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ let rec step (c : config) : config =
244244
let n1 = Lib.List32.length ts1 in
245245
let n2 = Lib.List32.length ts2 in
246246
let args, vs' = take n1 vs e.at, drop n1 vs e.at in
247-
vs', [Handler (n2, cs, (args, [Label (n2, [], ([], List.map plain es')) @@ e.at])) @@ e.at]
247+
vs', [Handler (n2, cs, ([], [Label (n2, [], (args, List.map plain es')) @@ e.at])) @@ e.at]
248248

249249
| Drop, v :: vs' ->
250250
vs', []

test/core/try_table.wast

+6
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,10 @@
238238
)
239239
)
240240
)
241+
242+
(func (export "try-with-param")
243+
(i32.const 0) (try_table (param i32) (drop))
244+
)
241245
)
242246

243247
(assert_return (invoke "simple-throw-catch" (i32.const 0)) (i32.const 23))
@@ -294,6 +298,8 @@
294298
(assert_exception (invoke "return-call-in-try-catch"))
295299
(assert_exception (invoke "return-call-indirect-in-try-catch"))
296300

301+
(assert_return (invoke "try-with-param"))
302+
297303
(module
298304
(func $imported-throw (import "test" "throw"))
299305
(tag $e0)

0 commit comments

Comments
 (0)