Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Call-indirect caching: protect against out-of-bounds table index duri…
…ng prescan. (#8541) * Call-indirect caching: protect against out-of-bounds table index during prescan. Call-indirect caching requires a "prescan" of a module's code section during compilation in order to know which tables are possibly written, and to count call-indirect callsites so that each separate function compilation can enable caching if possible and use the right slot range. This prescan is not integrated with the usual validation logic (nor should it be, probably, for performance), so it's possible that an out-of-bounds table index or other illegal instruction could be present. We previously indexed into an internal data structure (`table_plans`) with this index, allowing for a compilation panic on certain invalid modules before validation would have caught it. This PR fixes that with a one-off check at the single point that we interpret a parameter (the table index) from an instruction during the prescan. * Add test case.
- Loading branch information