Skip to content

Specify maximum static size for component value types - #688

Open
ANAMASGARD wants to merge 2 commits into
WebAssembly:mainfrom
ANAMASGARD:fix/component-type-size-limit
Open

Specify maximum static size for component value types#688
ANAMASGARD wants to merge 2 commits into
WebAssembly:mainfrom
ANAMASGARD:fix/component-type-size-limit

Conversation

@ANAMASGARD

Copy link
Copy Markdown

Fixes #682

Summary

Adds a spec-defined maximum static value size of 2^28 - 1 bytes for Component Model value types.

Validation now:

  • checks both i32 and i64 pointer types;
  • uses overflow-safe size calculations;
  • validates nested/despecialized types recursively;
  • rejects oversized types during validation instead of at runtime.

Includes Python and WAST regression tests for fixed-length lists, compound types, nested maps, pointer-width differences, and integer-overflow cases.

The WAST test remains in nyi.txt until wasm-tools/Wasmtime implement the corresponding validator rule.

Require resolved type AST nodes to satisfy elem_size <= 2^28 - 1 for
both i32 and i64 pointer types using overflow-safe validation, closing
fixed-length-list sizing hazards (WebAssembly#682).

Signed-off-by: Gaurav Chaudhary <chaudharygaurav2004@gmail.com>
Apply despecialize at each recursive check_resolved_type_size call so
nested map/option/record nodes are validated, not only top-level types.
Add regression tests for option<map<...>> and record fields (WebAssembly#682).

Signed-off-by: Gaurav Chaudhary <chaudharygaurav2004@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Should types have a spec-mandated maximum size?

1 participant