Skip to content

Commit

Permalink
wasmparser: Fix subtyping depth indexing
Browse files Browse the repository at this point in the history
fix: #1967

This patch addresses an issue in subtyping depth checking
where `set_subtyping_depth` indexes the depth by `CoreTypeId`,
but `get_subtyping_depth` accesses it using `CoreTypeId#index` (`u32`).
This leads to "IndexMap: index out of bounds" error when validating
WasmGC components with subtypes.

However, I have no idea why this issue occurs specifically in WasmGC components
and not in WasmGC modules.
  • Loading branch information
tanishiking committed Jan 7, 2025
1 parent 46881c9 commit 31192ae
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion crates/wasmparser/src/validator/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -995,7 +995,7 @@ impl TypeList {
let depth = self
.core_type_to_depth
.as_ref()
.expect("cannot get subtype depth from a committed list")[id.index()];
.expect("cannot get subtype depth from a committed list")[&id];
debug_assert!(usize::from(depth) <= crate::limits::MAX_WASM_SUBTYPING_DEPTH);
depth
}
Expand Down

0 comments on commit 31192ae

Please sign in to comment.