alexcrichton opened PR #4455 from fix-table-init-bug
to main
:
This commit fixes an issue with the initialization of element segments
when one of the elements in the element segment isref.func null
.
Previously the contents of a table were accidentally initialized with
the raw value of the*mut VMCallerCheckedAnyfunc
which bypassed the
"this is initialized" encoding of function table entries that Wasmtime
uses for lazy table initialization. The fix here was to ensure that the
encoded form is used.The impact of this issue is that a module could panic at runtime when
accessing a table element that was initialized with an element segment
containing aref.null func
entry. This only happens with imported
tables in a WebAssembly module where the table itself was defined on the
host. If the table was defined in another wasm module or in the local
wasm module this bug would not occur. Additionally this bug requires
enabling the reference types proposal for WebAssembly (which is enabled
by default) due to the usage of encodings for null funcrefs in element
segments.<!--
Please ensure that the following steps are all taken care of before submitting
the PR.
[ ] This has been discussed in issue #..., or if not, please tell us why
here.[ ] A short description of what this does, why it is needed; if the
description becomes long, the matter should probably be discussed in an issue
first.[ ] This PR contains test cases, if meaningful.
- [ ] A reviewer from the core maintainer team has been assigned for this PR.
If you don't know who could review this, please indicate so. The list of
suggested reviewers on the right can help you.Please ensure all communication adheres to the code of conduct.
-->
fitzgen submitted PR review.
alexcrichton has enabled auto merge for PR #4455.
alexcrichton merged PR #4455.
Last updated: Dec 23 2024 at 12:05 UTC