Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix parser of declarative element segments
The parser was incorrectly handling the parsing of declarative element segments (those with the `elemkind` of `declarative`). According to the spec, the `init` of the declarative element should be a `vec(expr)` if the prefix is 7. https://webassembly.github.io/spec/core/binary/modules.html#element-section However, binaryen was simply reading a single `u32LEB` value for each expression instead of parsing a expression regardless `usesExpressions = true`. This commit updates the `WasmBinaryReader::readElementSegments` function to correctly parse the expressions for declarative element segments by calling `readExpression` instead of `getU32LEB` if `usesExpressions = true`. Resolves the parsing exception: "[parse exception: bad section size, started at ... not being equal to new position ...]" Related discussion: tanishiking/scala-wasm#136
- Loading branch information