Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix a panic using tables with the wrong type
This commit fixes an accidental issue introduced in bytecodealliance#8018 where using an element segment which had been dropped with an `externref` table would cause a panic. The panic happened due to an assertion that tables are being used with the right type of item and that was being mismatched. The underlying issue was that dropped element segments are modeled as an empty element segment but the empty element segment was using the "functions" encoding as opposed to the "expressions" encoding. This meant that code later assumed that due to the use of functions the table must be a table-of-functions, but this was not correct for externref-based tables. The fix in this commit is to instead model the encoding as an "expressions" list which means that the table type is dispatched on to call the appropriate initializer. There is no memory safety issue with this mistake as the assertion was specifically targetted at preventing memory safety. This does, however, enable any WebAssembly module to panic a host. Closes bytecodealliance#8281
- Loading branch information