Skip to content

Commit 67bb08a

Browse files
authored
Fix tag import parsing in WasmOffsetConverter (#18691)
To parse a `tag_type`, we need to skip an `uint8` for an `attribute` and a `varuint32` for a `type`: https://github.com/WebAssembly/exception-handling/blob/main/proposals/exception-handling/Exceptions.md#tag_type Currently we only skip a byte, which I'm not sure was intended for the attribute or the type index.
1 parent 6b9eaf3 commit 67bb08a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/wasm_offset_converter.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ function WasmOffsetConverter(wasmBytes, wasmModule) {
8888
unsignedLEB128(); // skip function type
8989
break;
9090
case 1: // table import
91-
++offset; // FIXME: should be SLEB128
91+
unsignedLEB128(); // skip elem type
9292
skipLimits();
9393
break;
9494
case 2: // memory import
@@ -98,7 +98,8 @@ function WasmOffsetConverter(wasmBytes, wasmModule) {
9898
offset += 2; // skip type id byte and mutability byte
9999
break;
100100
case 4: // tag import
101-
++offset; // // FIXME: should be SLEB128
101+
++offset; // skip attribute
102+
unsignedLEB128(); // skip tag type
102103
break;
103104
#if ASSERTIONS
104105
default: throw 'bad import kind: ' + kind;

0 commit comments

Comments
 (0)