go-interpreter / wagon

wagon, a WebAssembly-based Go interpreter, for Go.
BSD 3-Clause "New" or "Revised" License
904 stars 148 forks source link

function DecodeModule implementation is not consistent with the wasm specification #144

Closed laizy closed 5 years ago

laizy commented 5 years ago

from the WebAssembly Specifications

The preamble is followed by a sequence of sections. Custom sections may be inserted at any place in this sequence, while other sections must occur at most once and in the prescribed order. All sections can be empty.

the current implementation use a for loop to decode the section data. so the prescribed order is not checked.

A similar processing logic as a reference is at https://github.com/CraneStation/cranelift/blob/master/cranelift-wasm/src/module_translator.rs#L14