alexcrichton opened PR #12897 from alexcrichton:verify-string-alignment to bytecodealliance:main:
The lifting code erroneously forgot to check for this. There's no actual consequence to this in Wasmtime per-se, but it's required in the component model spec to trap, so a trap is added here.
<!--
Please make sure you include the following information:
If this work has been discussed elsewhere, please include a link to that
conversation. If it was discussed in an issue, just mention "issue #...".Explain why this change is needed. If the details are in an issue already,
this can be brief.Our development process is documented in the Wasmtime book:
https://docs.wasmtime.dev/contributing-development-process.htmlPlease ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->
alexcrichton requested cfallin for a review on PR #12897.
alexcrichton requested wasmtime-core-reviewers for a review on PR #12897.
cfallin submitted PR review.
cfallin created PR review comment:
In order to avoid expensive ops that will be in the critical path of string-carrying APIs, could we use AND instead of an integer mod here (latter can be ~50 cycles or more)? Something like
debug_assert!(align.is_power_of_two()); if ptr & (align - 1) != 0 { ... }
alexcrichton updated PR #12897.
github-actions[bot] added the label wasmtime:api on PR #12897.
alexcrichton updated PR #12897.
alexcrichton has enabled auto merge for PR #12897.
alexcrichton updated PR #12897.
alexcrichton added PR #12897 Verify alignment of returned component-model strings to the merge queue.
alexcrichton removed PR #12897 Verify alignment of returned component-model strings from the merge queue.
alexcrichton merged PR #12897.
Last updated: Apr 12 2026 at 23:10 UTC