alexcrichton opened PR #13027 from alexcrichton:harden-strings to bytecodealliance:main:
Note: this is temporarily rebased on https://github.com/bytecodealliance/wasmtime/pull/13026
This commit is a hardening of the various in-bounds checks and such of
the FACT compiler, in particular as related to strings. The previous
implementation would check bounds in a few places but this was a bit
ad-hoc and not uniformly done. There's no known issue with the prior
checks, but given the sensitive nature of these checks I feel it's best
to make this a bit more rigorous.Specifically the
mallochelpers, and a newly addedreallochelper,
will internally verify not only alignment but additionally the size of
the allocation itself. All manual invocations ofreallocare switched
over to this helper. Additionally all conversion of a guest pointer to a
more structured value now additionally goes through helpers which
performs these same checks to ensure that everything is in-bounds.The net result is that this should have no behavior change from before.
A suite of tests are added for behavior around large strings,
specifically exercising the maximum allowable size of strings. This
uncovered a few minor issues in transcoding where spec-wise Wasmtime
previously transcoded too many bytes before performing a
growingrealloc.Finally a few refactorings were done in FACT to handle some helpers
going away, notably around translating themap<K, V>type, which
cleans up the internals as well.
alexcrichton requested uweigand for a review on PR #13027.
alexcrichton requested wasmtime-compiler-reviewers for a review on PR #13027.
alexcrichton requested wasmtime-core-reviewers for a review on PR #13027.
alexcrichton requested cfallin for a review on PR #13027.
cfallin submitted PR review.
cfallin has enabled auto merge for PR #13027.
cfallin added PR #13027 More strictly check bounds in FACT trampolines to the merge queue.
alexcrichton removed PR #13027 More strictly check bounds in FACT trampolines from the merge queue.
alexcrichton updated PR #13027.
alexcrichton has enabled auto merge for PR #13027.
alexcrichton added PR #13027 More strictly check bounds in FACT trampolines to the merge queue.
alexcrichton removed PR #13027 More strictly check bounds in FACT trampolines from the merge queue.
alexcrichton merged PR #13027.
Last updated: Apr 12 2026 at 23:10 UTC