Repository navigation
fix: Limit Wasm name section size - #12120
Merged
Merged
Conversation
|
✅ No security or compliance issues detected. Reviewed everything up to ae65197. Security OverviewDetected Code Changes
|
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The function-name entry limit incorrectly rejects valid modules with 50,000 named local functions and a named import; it must account for imports and include regression coverage.
1 open issue
What changed in this PR
This PR adds limits to the embedder’s early Wasm validation pass to bound function-name entries and imports before further parsing.
Changes:
- Limit function-name entries to 50,000 and imports to 200.
- Add validation errors, user guidance, and rejection tests for both limits.
- Make
MAX_FUNCTIONSpublic for reuse in validation and tests.
| File | Description |
|---|---|
rs/types/wasm_types/src/errors.rs |
Add errors and user guidance for exceeded limits. |
rs/embedders/tests/validation.rs |
Add rejection tests for excessive imports and function names. |
rs/embedders/src/wasm_utils/validation.rs |
Enforce import and function-name limits during early validation. |
rs/config/src/embedders.rs |
Expose the existing function-limit constant. |
Review effort: Balanced
mraszyk
reviewed
Nov 17, 2026
michael-weigelt
force-pushed
the
mwe/imports
branch
from
November 20, 2026 14:31
ec70402 to
e62cf36
Compare
…ssertion' Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
schneiderstefan
approved these changes
Nov 23, 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.

Limits the number of entries in the name section. It should not exceed the number of local functions.
Also limits the number of imports. The only allowed imports are the system API (~80) and a memory and a table.
Interface spec.