You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I believe wabt is correct here (though the error message could be clearer), the value that is being parsed is 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0xff 0x7e. The encoding uses 7 bits per byte, so the first 9 bytes encode 63 bits. The least-significant bit of the 10th byte encodes the sign bit of the 64-bit value, and it is required that the 7 more-significant bits are a sign-extension of this bit (i.e. they match). In this case, 0x7e has the sign-bit cleared, but the following bits set, which is invalid.
As confirmation, v8 also fails to load this module with a clearer error message:
CompileError: WebAssembly.Module(): Compiling wasm function #0 failed: extra bits in varint @+33
Activity
binji commentedon Mar 8, 2018
I believe wabt is correct here (though the error message could be clearer), the value that is being parsed is
0x80 0x80 0x80 0x80 0x80 0x80 0x80 0x80 0xff 0x7e. The encoding uses 7 bits per byte, so the first 9 bytes encode 63 bits. The least-significant bit of the 10th byte encodes the sign bit of the 64-bit value, and it is required that the 7 more-significant bits are a sign-extension of this bit (i.e. they match). In this case, 0x7e has the sign-bit cleared, but the following bits set, which is invalid.As confirmation, v8 also fails to load this module with a clearer error message:
pepyakin commentedon Mar 9, 2018
Oh, I see! I see that you created issue in the spec repo, thanks for that!
Also I seen such behavior in wasm-dis, so cc @kripken
kripken commentedon Mar 12, 2018
Thanks @pepyakin , I opened WebAssembly/binaryen#1469
binji commentedon Mar 16, 2018
OK, spec interpreter bug was fixed and binaryen has a bug filed, so closing here.