Repository navigation
Error on single items WIT can't express instead of panicking - #2814
Closed
sansmoraxz wants to merge 7 commits into
Closed
sansmoraxz wants to merge 7 commits into
sansmoraxz wants to merge 7 commits into
Conversation
Decoding read each section into a buffer sized up front by the length the input gives for it. A 14-byte input claiming a 4 GiB section made it allocate 4 GiB, which aborts the process where that fails. The buffer now grows with what is actually read.
Checking whether a function's result contains a `borrow` recursed once per alias, so parsing WIT with a long enough chain like `type t1 = t0; type t2 = t1; ...` overflowed the stack and aborted the process. The chain is now walked in a loop.
WIT types are value types and resources. Decoding panicked on a component that imports a component, instance or function type, or has an instance exporting one, and now returns an error.
Only interfaces have names like `a:b/c` in WIT. Decoding panicked on a function imported under such a name, and now returns an error.
Only interfaces have names like `a:b/c` in WIT. Decoding accepted a type imported or exported under such a name and printed `type a:b/c = ...`, which doesn't parse.
WIT puts a resource's constructor, methods and static functions in the interface that defines it. Decoding panicked on an interface with `[method]r.f` where `r` is only a `use` of another interface's resource, and now returns an error.
A core module's `component-type` custom section holds a component type with no imports and one world as its only export, as `wit-component` writes it. Decoding panicked on one with imports, with other than one export, or exporting something that isn't a world, and now returns an error.
sansmoraxz
force-pushed
the
wit-decode/2-items
branch
from
November 10, 2026 11:19
7f2e1ef to
d1de9b3
Compare
Contributor
Author
|
will recreate after first PR merges. |
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.
Followup on #2813
Decoding panicked with generic messages on components with items WIT has no form for, like imported function type, function or type named like
a:b/c, a method of a resource from another interface, or acomponent-typesection that isn't one world. These now throw "cannot represent this component in WIT" errors.