Skip to content

Commit 6ae8664

Browse files
committed
Fix incorrect code section byte counts in exception handling test
The hand-crafted WASM binary in load_module_with_exception_handling had an off-by-one in the code section: body size was declared as 7 but the actual body (local count + try/catch_all/end/end) is only 6 bytes. This caused the WASM loader to fail with "unexpected end" when it tried to read past the available bytes. Fix the body size from 7 to 6 and the code section size from 9 to 8.
1 parent 5166077 commit 6ae8664

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tests/unit/exception-handling/exception_handling_test.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ TEST_F(ExceptionHandlingTest, load_module_with_exception_handling)
8282
/* Export: "f" = func 0 */
8383
0x07, 0x05, 0x01, 0x01, 0x66, 0x00, 0x00,
8484
/* Code section */
85-
0x0A, 0x09, 0x01,
86-
0x07, 0x00, /* body size=7, 0 locals */
85+
0x0A, 0x08, 0x01,
86+
0x06, 0x00, /* body size=6, 0 locals */
8787
0x06, 0x40, /* try (void) */
8888
0x19, /* catch_all */
8989
0x0B, /* end try */

0 commit comments

Comments
 (0)