Repository navigation
Don't panic on empty core rec groups in components - #14976
Merged
alexcrichton merged 2 commits intoOct 26, 2026
Merged
Conversation
The component translator found each core rec group of a component from the type at the group's first index, which an empty rec group doesn't have, so `(component (core rec))` indexed out of bounds and `(component (core rec) (core type (module)))` used the module type instead. Empty rec groups define no types, so this skips them.
Comment on lines
907
to
920
Member
There was a problem hiding this comment.
Could this perhaps use a similar pattern to core modules to avoid the need to special-case here? In module_environ.rs the translation here is based on the number of types in a module, and I believe that could be done here as well by looking at the core type count within the component before/after the validator runs.
Contributor
Author
There was a problem hiding this comment.
This now works like module_environ.rs. It counts the core types before and after validating the section, then interns each rec group starting from its first type. An empty rec group adds no types, so it no longer needs a special case.
Like the type section in core modules, walk the core types that the validator added for this section rather than the section's rec groups, which handles empty rec groups without special-casing them.
alexcrichton
approved these changes
Oct 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
An empty core rec group in a component panics
Component::new, andwasmtime compile, with the default configuration. These all validate:(component (core rec))indexes out of bounds.(component (core rec) (core type (module)))unwraps anErr(()).(component (core type (sub (array i8))) (core rec))indexes out of bounds.The component translator found each core rec group from the type at the group's first index, which an empty group doesn't have, so it looked past the end of the core types or at the next definition's type. Like the type section of core modules, it now iterates over the core types that the validator added for the section instead of over the section's rec groups, so empty rec groups have nothing to intern.
Found by fuzzing Wasmtime with components generated from the component model's binary grammar (bytecodealliance/wasm-tools#2796).