subotac opened PR #14058 from subotac:fix/component-abi-size-overflow to bytecodealliance:main:
Fixes #13980.
Preserve the canonical ABI size overflow sentinel when aligning and composing record and variant layouts and when advancing field offsets.
Add regression coverage for dynamic and const record/variant layouts and 32-/64-bit field offsets.
Tests:
-
cargo test -p wasmtime-environ --features component-model
-cargo clippy -p wasmtime-environ --features component-model --all-targets -- -D warnings
-cargo fmt -p wasmtime-environ -- --check
subotac requested dicej for a review on PR #14058.
subotac requested wasmtime-core-reviewers for a review on PR #14058.
alexcrichton commented on PR #14058:
This feel s a bit too coarse to me to just slap
.saturating_*everywhere and return, for example, explicitly unaligned sizes onalign_toon overflow. With your understanding of this issue do you know of a more targeted fix?
subotac updated PR #14058.
subotac commented on PR #14058:
Thanks — I narrowed the fix in 3ca57ddca. align_to and the next_field* helpers now retain their original strict behavior. Only cached record/variant ABI size composition uses u64 intermediates and saturates at
u32::MAX, matching the existing fixed-length-list size representation. I also replaced the broad unit test with the issue reproducer in the fixed-length-list WAST suite.
alexcrichton commented on PR #14058:
Thanks for the updates, but reading over this again I continue to be left with a bit of unease about fixing this issue here. I think I'd personally prefer to go the route of https://github.com/WebAssembly/component-model/issues/682 and fix this at the component-model validation layer rather than in a bit of an ad-hoc fashion within Wasmtime here. I'd ideally like to take that as an opportunity to flesh out the tests here and expand them, too.
I don't believe that this is is a major issue for preexisting components and currently the only issue is when dealing with fixed-length-lists, so I think it's ok to leave this un-fixed on
mainfor a bit personally.
Last updated: Aug 30 2026 at 09:07 UTC