Comments (8)
I have a few colleagues who have seen the same thing. The solution is not entirely clear to me but @mbodart found that if you forced the definition of YY_INITIAL_VALUE to actually initialize things instead of maybe not doing it; then it seemed to work.
I have not confirmed this since I don't have an issue.
Maybe another solution is to regenerate the wasm-parser.c file that seems to be a problem but I tried to do that and my bison is not recent enough it seems (it fails).
from wabt.
Maybe another solution is to regenerate the wasm-parser.c file
I tried with bison 3.0.4. And it does not work.
from wabt.
I compiled and ran successfully on an ubuntu VM. The error still occurs on the host OS (Arch). I'm betting it has to do with the bison version
from wabt.
I tried it on a file and just got a bunch of (expected) errors. How did you generate test.wasm?
from wabt.
Same problem here. Bison 3.0.2, gcc 4.9.2. Workaround noted by @jcbeyler above works.
from wabt.
How did you generate test.wasm?
I started with the small example in README.md (which is perhaps out of date).
But here's another example:
(module
(func $test (result i32) (i32.add (i32.const 1) (i32.const 2)))
(export "test" $test))
The failure seems to be reproducible in a "known good" environment, if I simply
change the definition of YY_INITIAL_VALUE in wasm-parser.c to be empty.
(Note that I don't regenerate wasm-parser.c from wasm-parser.y.)
A quick run with valgrind points to problems in the vector append operations, e.g.
==21318== Conditional jump or move depends on uninitialised value(s)
==21318== at 0x41F2A7: ensure_capacity (wasm-vector.c:11)
==21318== by 0x41F369: append_element (wasm-vector.c:28)
==21318== by 0x4016F5: wasm_append_func_ptr (wasm.c:17)
==21318== by 0x401718: wasm_append_func_ptr_value (wasm.c:17)
==21318== by 0x40C9CC: wasm_parse (wasm-parser.y:1263)
==21318== by 0x403959: main (sexpr-wasm.c:180)
which suggests these module-level vectors are not initialized with null values
before being appended to.
Perhaps wasm-parser.y needs another surgically placed ZEROMEM?
from wabt.
Indeed, it seems the wasm-parser.y rule for module:
module :
LPAR MODULE module_fields RPAR {
$$.loc = @2;
needs a ZEROMEM($$);
That fixed this issue for me.
from wabt.
Ah, interesting. I've been running with clang's memory sanitizer, so I assume it would have caught a bug like this, but it seems not to have. Thanks for the fix!
from wabt.
Related Issues (20)
- wasm2c: Are module instances truly thread-safe? HOT 5
- can wast2json write out binary modules as they are without error checking? HOT 3
- wat2wasm fails converting .wast files in testsuite: error: unexpected token (, expected EOF. HOT 4
- feature request: support for WASI preview 2 component model HOT 1
- wat2wasm segfaults on .wat file with many nested if statements HOT 9
- Use of call_ref does not take a type indice in wat2wasm HOT 1
- Output results of the wasm-decompile to be easier to understand which function is called by call_indirect HOT 1
- [wasm2c] MSVC miscompiles for certain fp constants HOT 5
- WASM2C - What happened to wasm_rt_allocate_memory HOT 3
- Error using wasm2wat on a wasm file generated by Moonbit: "unexpected type form (got -0x30)" HOT 1
- Out-of-Memory Program Abort in wabt::interp::Table::Grow() HOT 2
- Out-of-Memory Program Abort in BinaryReaderInterp::OnDataCount()
- Invalid Memory Read in FreeList<wabt::interp::Object*>::IsUsed()
- error initializing module: invalid import "a.a" HOT 1
- Error while running testsuite (simd_lane, simd_load) "loop not vectorized" HOT 3
- wasm2wat: support component wasm HOT 1
- Wrong type error when validating globals with gc proposal features
- wat2wasm: Assertion `!"ParseExpr should only be called when IsExpr() is true"' failed in wabt::WastParser::ParseExpr
- Wast2Json fails on the testsuite HOT 8
- Library not loaded: /usr/local/opt/openssl@3/lib/libcrypto.3.dylib HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wabt.