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
Hello,
I noticed a couple of issues that might be related to mine - I'm not sure if mine's a duplicate of any though, so I'm creating it anyways, hopefully with some useful information and workarounds for others.
I've been trying to use wasm-edit to update .wasm files, but I noticed that it doesn't work and throws a "Invalid UTF-8 encoding" even with the simplest of the outputs from Rust + wasm-bindgen.
Error: invalid UTF-8 encoding
at _decode (./node_modules/@webassemblyjs/utf8/lib/decoder.js:43:13)
at Object.decode (./node_modules/@webassemblyjs/utf8/lib/decoder.js:25:10)
at readUTF8String (./node_modules/@webassemblyjs/wasm-parser/lib/decoder.js:229:22)
at parseSection (./node_modules/@webassemblyjs/wasm-parser/lib/decoder.js:1671:29)
at Object.decode (./node_modules/@webassemblyjs/wasm-parser/lib/decoder.js:1740:25)
at decode (./node_modules/@webassemblyjs/wasm-parser/lib/index.js:253:21)
at edit (./node_modules/@webassemblyjs/wasm-edit/lib/index.js:82:36)
I also noticed that this doesn't happen if I comment out the call to shrinkPaddedLEB128 below, or if I use editWithAST directly
With that said, there are a couple of flag combinations that I can pass to wasm-bindgen that will remove whatever problematic sections there are, and edit will work just fine.
The smallest set of additional flags I found to do that is --remove-name-section --remove-producers-section –
I'm not sure yet what these are useful for, but I imagine that they would be at least during development? Anyways, i can survive with my workaround for now 🙂
Hello,
I noticed a couple of issues that might be related to mine - I'm not sure if mine's a duplicate of any though, so I'm creating it anyways, hopefully with some useful information and workarounds for others.
I've been trying to use wasm-edit to update .wasm files, but I noticed that it doesn't work and throws a "Invalid UTF-8 encoding" even with the simplest of the outputs from Rust + wasm-bindgen.
Full stacktrace, just in case
I also noticed that this doesn't happen if I comment out the call to
shrinkPaddedLEB128
below, or if I useeditWithAST
directlywebassemblyjs/packages/wasm-edit/src/index.js
Line 17 in daf8b9e
With that said, there are a couple of flag combinations that I can pass to wasm-bindgen that will remove whatever problematic sections there are, and
edit
will work just fine.The smallest set of additional flags I found to do that is
--remove-name-section --remove-producers-section
–I'm not sure yet what these are useful for, but I imagine that they would be at least during development? Anyways, i can survive with my workaround for now 🙂
Here's a reproduction repo using
@webassemblyjs/[email protected]
:https://github.com/gustavohenke/wasm-bindgen-wasm-edit
Thanks in advance!
The text was updated successfully, but these errors were encountered: