issue_owner_repo
listlengths 2
2
| issue_body
stringlengths 0
261k
⌀ | issue_title
stringlengths 1
925
| issue_comments_url
stringlengths 56
81
| issue_comments_count
int64 0
2.5k
| issue_created_at
stringlengths 20
20
| issue_updated_at
stringlengths 20
20
| issue_html_url
stringlengths 37
62
| issue_github_id
int64 387k
2.46B
| issue_number
int64 1
127k
|
---|---|---|---|---|---|---|---|---|---|
[
"WebAssembly",
"wabt"
] |
Hello,
I am compiling JVM code to WAT for a personal project, and then using wat2wasm to convert it to WASM.
Since it works that way, I'd like to keep that process for now, and not implement WASM myself. (especially because WAT is easier to check and edit).
However, when I am converting JVM code to WAT, my project is quite a bit faster than WAT2WASM is (20.2s vs 35.3s; 109MB WAT -> 23.4MB WASM).
I added a little time measuring code to wat2wasm.cc, and found that
| Part | Time taken in ms |
|-----------------|-----------------:|
| read file | 132 |
| parsing | 20798 |
| validating | 10589 |
| write to buffer | 3728 |
| write to file | 30 |
I found validation can be disabled with "--no-check" (that's already a nice 10s improvement, and most times my generated code is correct now).
What can you recommend, how I can debug / measure how to make parsing faster?
|
wat2wasm slow? How to debug?
|
https://api.github.com/repos/WebAssembly/wabt/issues/2030/comments
| 2 |
2022-10-30T11:16:08Z
|
2022-11-01T19:50:51Z
|
https://github.com/WebAssembly/wabt/issues/2030
| 1,428,737,813 | 2,030 |
[
"WebAssembly",
"wabt"
] |
```
(module
(func
block
br 0
;; Dead code, but still seems a validation error.
drop
end
))
```
The `drop` instruction should expect something on the stack.
|
Dead code stack validation error
|
https://api.github.com/repos/WebAssembly/wabt/issues/2027/comments
| 2 |
2022-10-27T05:28:13Z
|
2022-10-27T07:22:20Z
|
https://github.com/WebAssembly/wabt/issues/2027
| 1,425,054,649 | 2,027 |
[
"WebAssembly",
"wabt"
] |
```
(module
(func (local i32)
block
i32.const 3
if (result i32)
i32.const 4
else
i32.const 3
if (result i32)
i32.const 4
else
local.get 0
end
local.set 0
;; This instruction pushes an i32 which is never used
;; Code should be invalid.
i32.const 5
br 1
end
local.set 0
end
))
```
This code should be a validation error, since the `i32.const 5` pushes a value which is never consumed.
|
Stack validation error
|
https://api.github.com/repos/WebAssembly/wabt/issues/2026/comments
| 2 |
2022-10-27T05:22:35Z
|
2022-10-27T07:21:34Z
|
https://github.com/WebAssembly/wabt/issues/2026
| 1,425,050,326 | 2,026 |
[
"WebAssembly",
"wabt"
] |
When both the multi-memory and memory64 features are enabled it's possible for memory.copy to copy between two memories of different types. In this case, the memory64 proposal specifies that the src and dst arguments should correspond to the types of the memory they are accessing, and the size argument should correspond to the "minimum" of the two memory types [1]. That is, the size should be an i32 if either of the memories has type i32 and it should be i64 if both of the memories have type i64.
This existing code just expects all three arguments to match the type of the source memory which works whenever the source and destination memories have the same type, but doesn't match the `memory64` proposal when the two memories have different types.
This also conflicts with the current implementation of `wasmtime`. This example `wat`:
```
;; test.wat
(module
(memory $mem32 i32 1)
(memory $mem64 i64 1)
(func
i32.const 1
i64.const 0
i32.const 0
memory.copy $mem32 $mem64
)
)
```
compiles fine with `wasmtime`:
```
wasmtime compile --wasm-features all test.wat
```
but fails to be converted with `wat2wasm`:
```
wat2wasm --enable-all test.wat
test.wat:8:5: error: type mismatch in memory.copy, expected [i64, i64, i64] but got [i32, i64, i32]
memory.copy $mem32 $mem64
^^^^^^^^^^^
```
These use commit `4867813f7717653cd6317f11a9df6966653d450c` of `wasmtime` and commit `eca3519d738bcd245d46915e9c373c6d58f5b20b` of `wabt`.
[1]
https://github.com/WebAssembly/memory64/blob/5bfb70d9888b96a2f3d6412ed3599b91364da610/proposals/memory64/Overview.md?plain=1#L211
|
Incorrect arguments for `memory.copy` between memories of different types
|
https://api.github.com/repos/WebAssembly/wabt/issues/2025/comments
| 1 |
2022-10-26T10:22:21Z
|
2022-11-02T01:09:35Z
|
https://github.com/WebAssembly/wabt/issues/2025
| 1,423,789,456 | 2,025 |
[
"WebAssembly",
"wabt"
] |
I noticed this during catching up with [the latest spec test](https://github.com/WebAssembly/spec/commit/f2b7c60c6726d0857f137d9243107a74f8538668)
Steps to repro:
```
$ cat original.wat
(module
(import "exporter" "table" (table $t 2 externref))
(elem (i32.const 0) externref (ref.null extern)))
$ wasm-tools parse original.wat -o wt.wasm && wasm-tools print wt.wasm -o wt.wat
$ cat wt.wat
(module
(import "exporter" "table" (table $t 2 externref))
(elem (;0;) (i32.const 0) externref (ref.null extern)))
$ ~/wabt-1.0.30/bin/wat2wasm original.wat -o wabt.wasm && wasm-tools print wabt.wasm -o wabt.wat
$ cat wabt.wat
(module
(import "exporter" "table" (table (;0;) 2 externref))
(elem (;0;) (i32.const 0) funcref (ref.null extern)))
```
So it seems like `wat2wasm` produces the element with the initial byte `0x4` which is fixed to `funcref`.
|
wat2wasm: incorrectly produces funcref from externref element
|
https://api.github.com/repos/WebAssembly/wabt/issues/2022/comments
| 2 |
2022-10-24T09:18:27Z
|
2022-11-14T00:11:40Z
|
https://github.com/WebAssembly/wabt/issues/2022
| 1,420,510,753 | 2,022 |
[
"WebAssembly",
"wabt"
] |
Compiling WABT 1.0.30 with gcc 12.2.0, I get the following warning:
```
/usr/include/c++/12/bits/stl_pair.h:665:43: warning: ‘index’ may be used uninitialized [-Wmaybe-uninitialized]
665 | || (!(__y.first < __x.first) && __x.second < __y.second); }
| ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
src/wat-writer.cc: In function ‘wabt::Result src/wat-writer.cc:1717:9: note: ‘index’ was declared here
1717 | Index index;
```
|
warning: ‘index’ may be used uninitialized
|
https://api.github.com/repos/WebAssembly/wabt/issues/2020/comments
| 2 |
2022-10-17T22:58:35Z
|
2023-03-22T01:47:45Z
|
https://github.com/WebAssembly/wabt/issues/2020
| 1,412,341,517 | 2,020 |
[
"WebAssembly",
"wabt"
] |
Now that wasm2c has almost caught up to the current Wasm spec, maybe it's a good time to brainstorm about the roadmap from here and see what everything else thinks is useful/worth prioritizing. Here are some possible items and thoughts to get the discussion going:
- [ ] A WASI implementation for Unix-ish hosts (PR #2002) -- will be awesome to have this in
- [ ] Some sort of continuous performance regression testing. Basically an operationalized/ongoing version of the benchmarks at https://kripken.github.io/blog/wasm/2020/07/27/wasmboxc.html
- [ ] Increased safety when modules link with other modules. Right now it's pretty easy to create a segfault (or worse) by having one module import something by name, and another module exports something with the same name but an incompatible type, because right now wasm2c makes "optimistic" extern declarations for everything that's imported. We could improve this by making the wasm2c-generated code actually include the header from the imported-from module (so the C compiler will enforce type correctness), instead of making an optimistic declaration in its own header (#1908), or by reintroducing some sort of type mangling.
- [x] SIMD support (PR #2119). This is the last remaining piece to get full conformance with WebAssembly 2.0, and it would be kind of cool to say we conform to the whole spec before it's finalized. I think I've done most of the scaffolding work, but still need to implement all those instructions, ideally in a way that spits out generated code that's both (a) inlined to SSE2 intrinsics when available, but also (b) with backup implementations in pure C for everywhere else, and then (c) ideally we'd test both backends in the CI.
- [x] Get Mozilla using the upstream wasm2c as part of the Firefox build process. Would probably be great to have a production "customer"; I know they had wanted bulk memory support (which we now have) but I think they probably also depend on a bunch of features in the UCSD/rlbox fork. We could work with Mozilla/UCSD to get them transitioned over to the main branch.
- [x] wasm2c "one .c file per function" mode (PR #2146). It takes a huge amount of time and memory for gcc/clang to compile the output of wasm2c for a big program (especially with optimization) because it's just one gigantic C file. But the structure of wasm2c's output is so well-structured that it would be trivial to split it up into a single .c file per function (each importing the same .h file as currently). This is probably much more parallelism than is even in the original program. *And* if the function names remain stable, then with a memoized/hashing build system, it would be possible to change or insert just one function in a gigantic program and 99% of the work of compiling the wasm2c output could be memoized. This would be super-cool. (You might worry about losing opportunities to inline, for which I think the best answers would be (a) we should do the continuous performing monitoring of above, (b) you don't have to use this option, (c) LTO, or (d) hopefully the good inlining opportunities were already taken upstream by the optimizing compiler that produced the .wasm file in the first place.)
- [x] Speeding up wasm2c itself on large programs (PR #2171 for a big chunk of this). One approach might be to move away from using BinaryReaderIR (which manifests the entire program in RAM) and create a custom BinaryReaderWasm2C that could process the file in one pass in a streaming manner, just like we have BinaryReaderInterp already. This may be a bit risky because (a) now we have to make sure we hook into the validator everywhere we need to or else badness, and (b) I don't know how much the performance improvement would be, but I think w2c2 suggests this might be a fruitful route.
- [ ] Better fuzzing. I don't think we're fuzzing wasm2c right now at all. It would be nice to have a fuzz target in OSS-fuzz, ideally one that not only checks for safety violations but also tries to find disagreements between wasm2c's output (when compiled and run) vs. the WABT interpreter.
- [ ] Selectable behavior on a per-memory basis about whether OOB is hardware-checked or software-checked. For the main memory of a long-running program, it's much faster to use mprotect and the signal handler to detect OOB on a memory. But for memories that are attached transiently to some random region of memory (to give zero-copy access to a binary blob) and then detached, it's a lot of overhead to have to set up these 8 GiB mmapped/mprotected regions for everything you might want to ever point to. It would be nice to be able to tell CWriter which memories in a module should have explicit (software) OOB checks on load/store and which should rely on the MMU and signal handler. This could be done by... (a) adding a field to the Memory structure in the IR (most convenient, but kind of icky since it's really a wasm2c-specific annotation), or (b) some sort of condition that depends on the debug name of the memory, or (c) maybe something in the WriteCOptions that allows the caller to indicate its preference on a per-memory basis. We're using "a" in our private branch, but if this is more general interest, happy to find consensus on the best approach in general.
- [x] (Added 11/8): Ability to "de-init" an individual module and remove its func types from the runtime, leaving other modules intact? (Effectively done a different way in #2120.)
- [ ] (Added 4/5) Add a method to "reinstantiate" ("reset"?) a module instance without having to free and then instantiate a new one.
- [ ] Start work on wasm2rust. Not totally serious, but it would be cool if this existed.
|
wasm2c roadmap ideas
|
https://api.github.com/repos/WebAssembly/wabt/issues/2019/comments
| 8 |
2022-10-12T21:23:55Z
|
2023-07-30T23:48:50Z
|
https://github.com/WebAssembly/wabt/issues/2019
| 1,406,825,652 | 2,019 |
[
"WebAssembly",
"wabt"
] |
Trying with eca3519d (current main branch), wast2json can parse [return_call.wast](https://github.com/WebAssembly/testsuite/blob/4f77306bb63151631d84f58dedf67958eb9911b9/proposals/tail-call/return_call.wast), but it cannot parse [return_call_indirect.wast](https://github.com/WebAssembly/testsuite/blob/4f77306bb63151631d84f58dedf67958eb9911b9/proposals/tail-call/return_call_indirect.wast). Output:
```
$ ~/wasm/wabt/build/wast2json --enable-all return_call_indirect.wast
return_call_indirect.wast:160:38: error: unexpected token "type", expected an expr.
(then (return_call_indirect 1 (type $out-i32) (i32.const 0)))
^^^^
return_call_indirect.wast:48:7: error: undefined function variable "$fac"
$fac $fac-acc $even $odd
^^^^
return_call_indirect.wast:48:12: error: undefined function variable "$fac-acc"
$fac $fac-acc $even $odd
^^^^^^^^
return_call_indirect.wast:48:21: error: undefined function variable "$even"
$fac $fac-acc $even $odd
^^^^^
return_call_indirect.wast:48:27: error: undefined function variable "$odd"
$fac $fac-acc $even $odd
^^^^
```
|
wast2json fails to parse tail call proposal test file
|
https://api.github.com/repos/WebAssembly/wabt/issues/2018/comments
| 1 |
2022-10-11T16:47:46Z
|
2022-11-08T19:19:34Z
|
https://github.com/WebAssembly/wabt/issues/2018
| 1,404,945,070 | 2,018 |
[
"WebAssembly",
"wabt"
] |
👋 trying to build the latest release, but run into some build issue. The error log is as below:
<details>
<summary>build error</summary>
```
/tmp/wabt-20221003-91990-ggldl9/src/interp/interp-wasi.cc:647:10: fatal error: 'wasi_api.def' file not found
#include "wasi_api.def"
^~~~~~~~~~~~~~
1 error generated.
```
</details>
full build log, https://github.com/Homebrew/homebrew-core/actions/runs/3178360168/jobs/5179823985
relates to Homebrew/homebrew-core#112291
|
wabt 1.0.30 build issue
|
https://api.github.com/repos/WebAssembly/wabt/issues/2016/comments
| 1 |
2022-10-06T20:37:07Z
|
2022-10-06T22:48:49Z
|
https://github.com/WebAssembly/wabt/issues/2016
| 1,400,269,672 | 2,016 |
[
"WebAssembly",
"wabt"
] |
When running CMake and installing wabt, library loading issues are occurring around `cwriter-template`. This just started occurring with 1.0.30 and did not occur with 1.0.29. For example:
```
wasm2c --help
wasm2c: error while loading shared libraries: libcwriter-template.so: cannot open shared object file: No such file or directory
```
Here is the [attached log]( https://github.com/WebAssembly/wabt/files/9704508/wabt-feedstock_20221003_1_linux_64.txt ) for more details. Also here is [the build script]( https://github.com/conda-forge/wabt-feedstock/blob/3452251fa3ff6d2375280fcc55a5372f66b66b47/recipe/build.sh#L1 ). This example is with Linux, but am seeing the same issue on other platforms.
AFAICT the `cwriter-template` library is not getting installed with everything else. Not sure if an `install` command is missing or if I should be doing something else.
|
cwriter-template not being installed with 1.0.30?
|
https://api.github.com/repos/WebAssembly/wabt/issues/2014/comments
| 0 |
2022-10-04T09:32:13Z
|
2022-10-04T20:45:03Z
|
https://github.com/WebAssembly/wabt/issues/2014
| 1,395,947,382 | 2,014 |
[
"WebAssembly",
"wabt"
] |
Parser driving demo page is broken. (https://webassembly.github.io/wabt/demo/wat2wasm/) It doesn't parse many standard WABT examples.
~ It fails to parse several of its own sample code, including, for example 'sign-extension'.
~ It fails to parse its own sample code from about a year ago. See below.
~ If fails to parse sample code given here:
https://developer.mozilla.org/en-US/docs/WebAssembly/Reference/Control_flow/br
My sense is that commands like `get_local`, `set_local`, `get_global` and `set_global` have been dropped, killing backward compatibility.
```(module
(func $subtract (param i32 i32) (result i32)
get_local 0 ;; 2
get_local 1 ;; 5
i32.sub)
)
```
|
Demo parser is broken
|
https://api.github.com/repos/WebAssembly/wabt/issues/2010/comments
| 4 |
2022-09-30T12:20:32Z
|
2022-10-03T12:57:45Z
|
https://github.com/WebAssembly/wabt/issues/2010
| 1,392,356,299 | 2,010 |
[
"WebAssembly",
"wabt"
] |
Now that the header layout change has landed, we (Halide) would like to have a version number to point to. I think this requires just a one-line change for the version number in the CMakeLists.txt file and then a Github release.
Are there any blockers I'm not aware of?
|
Tag 1.0.30?
|
https://api.github.com/repos/WebAssembly/wabt/issues/2007/comments
| 6 |
2022-09-28T14:44:13Z
|
2022-10-04T19:55:40Z
|
https://github.com/WebAssembly/wabt/issues/2007
| 1,389,493,234 | 2,007 |
[
"WebAssembly",
"wabt"
] |
I would like to make imports simpler for wasm testing with the `wasm-interp` tool.
Nothing fancy just something like
`-m, --module=[NAME:]PATH`
`use PATH as a wasm module and provide all exports under the name NAME (filename if not present) for imports`
This way you could load any wasm-modules or possibly native libraries and expose all names to others. testing wasm modules would be a lot simpler.
Adding the argument to the parser is fine, literally a oneliner.
However, I am confused on how to link exports from one module to the imports of others. I checked `BindImports` from `src/tools/wasm-interp.cc` and `WasiBindImports` from `src/interp/interp-wasm.cc` and I think I get how to add them to the imports-list, but how do I *get* the function for pushing onto the imports?
|
Load other wasm (and possibly native) modules for exposing exports/imports
|
https://api.github.com/repos/WebAssembly/wabt/issues/2005/comments
| 13 |
2022-09-22T18:44:08Z
|
2022-09-28T21:42:02Z
|
https://github.com/WebAssembly/wabt/issues/2005
| 1,382,867,297 | 2,005 |
[
"WebAssembly",
"wabt"
] |
I would like to ask how wasm is converted to S-expression form in wasm2wat. I know the concept of S-expressions, but I can't relate S-expressions to wasm instructions.
|
How wasm is converted to S-expression form in wasm2wat?
|
https://api.github.com/repos/WebAssembly/wabt/issues/2000/comments
| 4 |
2022-09-21T09:47:38Z
|
2022-09-23T01:57:12Z
|
https://github.com/WebAssembly/wabt/issues/2000
| 1,380,644,797 | 2,000 |
[
"WebAssembly",
"wabt"
] |
Hey,
I am working on a compiler to port my game engine from JVM to WASM, but unfortunately, for my current file, wat2wasm just crashes without printing information, and it returns -1073741571 (-0x3FFFFF03).
I run it three times, and always got the same return type.
What am I doing wrong? / where is the internal bug in wabt?
|
Return code -1073741571 in wat2wasm.
|
https://api.github.com/repos/WebAssembly/wabt/issues/1997/comments
| 7 |
2022-09-18T18:41:56Z
|
2022-09-19T07:01:51Z
|
https://github.com/WebAssembly/wabt/issues/1997
| 1,377,143,334 | 1,997 |
[
"WebAssembly",
"wabt"
] |
It looks like clang/llvm converts function return types and parameters to signed (s32/s64) and wasm2c treats all numbers as unsinged. (unless there is also bug in wasm2wat which displays numeric types as signed)
Compiling following code:
```
int main() {
return 1;
}
```
-> wasm2wat
```
(module
(type (;0;) (func (result i32)))
(func $__original_main (type 0) (result i32)
(local i64 i64 i64 i32 i32)
global.get $__stack_pointer
local.set 0
i64.const 16
local.set 1
local.get 0
local.get 1
i64.sub
local.set 2
i32.const 0
local.set 3
local.get 2
local.get 3
i32.store offset=12
i32.const 1
local.set 4
local.get 4
return)
(table (;0;) 1 1 funcref)
(memory (;0;) i64 2)
(global $__stack_pointer (mut i64) (i64.const 66560))
(export "memory" (memory 0)))
```
-> wasm2c produces following signature for main:
```
static u32 w2c___original_main(void) {
```
-> if I change `int` to `unsigned int` in original code
```
(module
(type (;0;) (func (result i32)))
(func $main1__ (type 0) (result i32)
(local i32)
i32.const 1
local.set 0
local.get 0
return)
```
-> wasm2c
```
static u32 w2c_main1__(void) {
```
|
wasm2c converts signed to unsinged
|
https://api.github.com/repos/WebAssembly/wabt/issues/1995/comments
| 1 |
2022-09-15T15:46:36Z
|
2022-09-15T18:11:07Z
|
https://github.com/WebAssembly/wabt/issues/1995
| 1,374,741,366 | 1,995 |
[
"WebAssembly",
"wabt"
] |
### Environment
```
OS : Linux ubuntu 5.15.0-46-generic #49~20.04.1-Ubuntu SMP Thu Aug 4 19:15:44 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
Commit : 3054d61f703d609995798f872fc86b462617c294
Version : 1.0.29
Build : make clang-debug-asan
```
### Proof of concept
[poc-5.wasm.zip](https://github.com/WebAssembly/wabt/files/9490262/poc-5.wasm.zip)
### Stack dump
```
AddressSanitizer:DEADLYSIGNAL
=================================================================
==1681910==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x7f858ec47234 bp 0x7ffce2314ff0 sp 0x7ffce2314ef8 T0)
==1681910==The signal is caused by a READ memory access.
==1681910==Hint: address points to the zero page.
#0 0x7f858ec47234 in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>::operator std::basic_string_view<char, std::char_traits<char>>() const (/lib/x86_64-linux-gnu/libstdc++.so.6+0x186234)
#1 0x61d4eb in unsigned long wabt::cat_compute_size<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, char [3]>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, char const (&) [3]) /wabt/out/clang/Debug/asan/../../../../src/string-util.h:68:27
#2 0x61d39d in unsigned long wabt::cat_compute_size<char [5], std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, char [3]>(char const (&) [5], std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, char const (&) [3]) /wabt/out/clang/Debug/asan/../../../../src/string-util.h:68:39
#3 0x61d235 in unsigned long wabt::cat_compute_size<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, char [5], std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, char [3]>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, char const (&) [5], std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, char const (&) [3]) /wabt/out/clang/Debug/asan/../../../../src/string-util.h:68:39
#4 0x61d005 in unsigned long wabt::cat_compute_size<char [5], std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, char [5], std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, char [3]>(char const (&) [5], std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, char const (&) [5], std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, char const (&) [3]) /wabt/out/clang/Debug/asan/../../../../src/string-util.h:68:39
#5 0x60f57f in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> wabt::cat<char [5], std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, char [5], std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, char [3]>(char const (&) [5], std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, char const (&) [5], std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, char const (&) [3]) /wabt/out/clang/Debug/asan/../../../../src/string-util.h:75:13
#6 0x5d137d in wabt::Decompiler::DecompileExpr(wabt::Node const&, wabt::Node const*) /wabt/out/clang/Debug/asan/../../../../src/decompiler.cc:530:20
#7 0x5ccb59 in wabt::Decompiler::DecompileExpr(wabt::Node const&, wabt::Node const*) /wabt/out/clang/Debug/asan/../../../../src/decompiler.cc:357:22
#8 0x5c30b4 in wabt::Decompiler::Decompile[abi:cxx11]() /wabt/out/clang/Debug/asan/../../../../src/decompiler.cc:825:20
#9 0x5be6bd in wabt::Decompile[abi:cxx11](wabt::Module const&, wabt::DecompileOptions const&) /wabt/out/clang/Debug/asan/../../../../src/decompiler.cc:854:21
#10 0x4f16bd in ProgramMain(int, char**) /wabt/out/clang/Debug/asan/../../../../src/tools/wasm-decompile.cc:103:18
#11 0x4f2101 in main /wabt/out/clang/Debug/asan/../../../../src/tools/wasm-decompile.cc:116:10
#12 0x7f858e754082 in __libc_start_main /build/glibc-SzIz7B/glibc-2.31/csu/../csu/libc-start.c:308:16
#13 0x43f04d in _start (/wabt/out/clang/Debug/asan/wasm-decompile+0x43f04d)
AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV (/lib/x86_64-linux-gnu/libstdc++.so.6+0x186234) in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>::operator std::basic_string_view<char, std::char_traits<char>>() const
==1681910==ABORTING
```
|
SEGV in wabt::cat_compute_size
|
https://api.github.com/repos/WebAssembly/wabt/issues/1992/comments
| 1 |
2022-09-05T13:44:45Z
|
2022-09-05T13:49:27Z
|
https://github.com/WebAssembly/wabt/issues/1992
| 1,362,003,678 | 1,992 |
[
"WebAssembly",
"wabt"
] |
### Environment
```
OS : Linux ubuntu 5.15.0-46-generic #49~20.04.1-Ubuntu SMP Thu Aug 4 19:15:44 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
Commit : 3054d61f703d609995798f872fc86b462617c294
Version : 1.0.29
Build : make clang-debug-asan
```
### Proof of concept
[poc-4.wasm.zip](https://github.com/WebAssembly/wabt/files/9490195/poc-4.wasm.zip)
### Stack dump
```
AddressSanitizer:DEADLYSIGNAL
=================================================================
==1832827==ERROR: AddressSanitizer: SEGV on unknown address 0xffffffffffffffe8 (pc 0x7f6b08ea4c96 bp 0xffffffffffffffe0 sp 0x7ffe8c530b20 T0)
==1832827==The signal is caused by a READ memory access.
#0 0x7f6b08ea4c96 in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>::operator+=(char const*) (/lib/x86_64-linux-gnu/libstdc++.so.6+0x144c96)
#1 0x60796b in wabt::Decompiler::WrapNAry(std::vector<wabt::Decompiler::Value, std::allocator<wabt::Decompiler::Value>>&, std::basic_string_view<char, std::char_traits<char>>, std::basic_string_view<char, std::char_traits<char>>, wabt::Decompiler::Precedence) /wabt/out/clang/Debug/asan/../../../../src/decompiler.cc:205:26
#2 0x5d4a2b in wabt::Decompiler::DecompileExpr(wabt::Node const&, wabt::Node const*) /wabt/out/clang/Debug/asan/../../../../src/decompiler.cc:664:16
#3 0x5ccb59 in wabt::Decompiler::DecompileExpr(wabt::Node const&, wabt::Node const*) /wabt/out/clang/Debug/asan/../../../../src/decompiler.cc:357:22
#4 0x5ccb59 in wabt::Decompiler::DecompileExpr(wabt::Node const&, wabt::Node const*) /wabt/out/clang/Debug/asan/../../../../src/decompiler.cc:357:22
#5 0x5ccb59 in wabt::Decompiler::DecompileExpr(wabt::Node const&, wabt::Node const*) /wabt/out/clang/Debug/asan/../../../../src/decompiler.cc:357:22
#6 0x5ccb59 in wabt::Decompiler::DecompileExpr(wabt::Node const&, wabt::Node const*) /wabt/out/clang/Debug/asan/../../../../src/decompiler.cc:357:22
#7 0x5c30b4 in wabt::Decompiler::Decompile[abi:cxx11]() /wabt/out/clang/Debug/asan/../../../../src/decompiler.cc:825:20
#8 0x5be6bd in wabt::Decompile[abi:cxx11](wabt::Module const&, wabt::DecompileOptions const&) /wabt/out/clang/Debug/asan/../../../../src/decompiler.cc:854:21
#9 0x4f16bd in ProgramMain(int, char**) /wabt/out/clang/Debug/asan/../../../../src/tools/wasm-decompile.cc:103:18
#10 0x4f2101 in main /wabt/out/clang/Debug/asan/../../../../src/tools/wasm-decompile.cc:116:10
#11 0x7f6b089f3082 in __libc_start_main /build/glibc-SzIz7B/glibc-2.31/csu/../csu/libc-start.c:308:16
#12 0x43f04d in _start (/wabt/out/clang/Debug/asan/wasm-decompile+0x43f04d)
AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV (/lib/x86_64-linux-gnu/libstdc++.so.6+0x144c96) in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>::operator+=(char const*)
==1832827==ABORTING
```
|
SEGV in wabt::Decompiler::WrapNAry
|
https://api.github.com/repos/WebAssembly/wabt/issues/1991/comments
| 0 |
2022-09-05T13:38:19Z
|
2022-09-18T05:06:15Z
|
https://github.com/WebAssembly/wabt/issues/1991
| 1,361,991,190 | 1,991 |
[
"WebAssembly",
"wabt"
] |
### Environment
```
OS : Linux ubuntu 5.15.0-46-generic #49~20.04.1-Ubuntu SMP Thu Aug 4 19:15:44 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
Commit : 3054d61f703d609995798f872fc86b462617c294
Version : 1.0.29
Build : make clang-debug-asan
```
### Proof of concept
[poc-3.wasm.zip](https://github.com/WebAssembly/wabt/files/9490169/poc-3.wasm.zip)
### Stack dump
```
AddressSanitizer:DEADLYSIGNAL
=================================================================
==1814123==ERROR: AddressSanitizer: SEGV on unknown address 0xffffffffffffffe8 (pc 0x7f12f2723bfe bp 0x7ffe034681e0 sp 0x7ffe03467e18 T0)
==1814123==The signal is caused by a READ memory access.
#0 0x7f12f2723bfe in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>::append(char const*, unsigned long) (/lib/x86_64-linux-gnu/libstdc++.so.6+0x144bfe)
#1 0x609269 in wabt::Decompiler::WrapChild(wabt::Decompiler::Value&, std::basic_string_view<char, std::char_traits<char>>, std::basic_string_view<char, std::char_traits<char>>, wabt::Decompiler::Precedence) /wabt/out/clang/Debug/asan/../../../../src/decompiler.cc:125:18
#2 0x619663 in wabt::Decompiler::BracketIfNeeded(wabt::Decompiler::Value&, wabt::Decompiler::Precedence) /wabt/out/clang/Debug/asan/../../../../src/decompiler.cc:143:11
#3 0x60ce08 in wabt::Decompiler::WrapBinary(std::vector<wabt::Decompiler::Value, std::allocator<wabt::Decompiler::Value>>&, std::basic_string_view<char, std::char_traits<char>>, bool, wabt::Decompiler::Precedence) /wabt/out/clang/Debug/asan/../../../../src/decompiler.cc:153:5
#4 0x5cfb8b in wabt::Decompiler::DecompileExpr(wabt::Node const&, wabt::Node const*) /wabt/out/clang/Debug/asan/../../../../src/decompiler.cc:473:16
#5 0x5ccb59 in wabt::Decompiler::DecompileExpr(wabt::Node const&, wabt::Node const*) /wabt/out/clang/Debug/asan/../../../../src/decompiler.cc:357:22
#6 0x5ccb59 in wabt::Decompiler::DecompileExpr(wabt::Node const&, wabt::Node const*) /wabt/out/clang/Debug/asan/../../../../src/decompiler.cc:357:22
#7 0x5ccb59 in wabt::Decompiler::DecompileExpr(wabt::Node const&, wabt::Node const*) /wabt/out/clang/Debug/asan/../../../../src/decompiler.cc:357:22
#8 0x5ccb59 in wabt::Decompiler::DecompileExpr(wabt::Node const&, wabt::Node const*) /wabt/out/clang/Debug/asan/../../../../src/decompiler.cc:357:22
#9 0x5ccb59 in wabt::Decompiler::DecompileExpr(wabt::Node const&, wabt::Node const*) /wabt/out/clang/Debug/asan/../../../../src/decompiler.cc:357:22
#10 0x5c30b4 in wabt::Decompiler::Decompile[abi:cxx11]() /wabt/out/clang/Debug/asan/../../../../src/decompiler.cc:825:20
#11 0x5be6bd in wabt::Decompile[abi:cxx11](wabt::Module const&, wabt::DecompileOptions const&) /wabt/out/clang/Debug/asan/../../../../src/decompiler.cc:854:21
#12 0x4f16bd in ProgramMain(int, char**) /wabt/out/clang/Debug/asan/../../../../src/tools/wasm-decompile.cc:103:18
#13 0x4f2101 in main /wabt/out/clang/Debug/asan/../../../../src/tools/wasm-decompile.cc:116:10
#14 0x7f12f2272082 in __libc_start_main /build/glibc-SzIz7B/glibc-2.31/csu/../csu/libc-start.c:308:16
#15 0x43f04d in _start (/wabt/out/clang/Debug/asan/wasm-decompile+0x43f04d)
AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV (/lib/x86_64-linux-gnu/libstdc++.so.6+0x144bfe) in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>::append(char const*, unsigned long)
==1814123==ABORTING
```
|
SEGV in wabt::Decompiler::WrapChild
|
https://api.github.com/repos/WebAssembly/wabt/issues/1990/comments
| 1 |
2022-09-05T13:34:09Z
|
2023-03-17T12:06:11Z
|
https://github.com/WebAssembly/wabt/issues/1990
| 1,361,983,620 | 1,990 |
[
"WebAssembly",
"wabt"
] |
### Environment
```
OS : Linux ubuntu 5.15.0-46-generic #49~20.04.1-Ubuntu SMP Thu Aug 4 19:15:44 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
Commit : 3054d61f703d609995798f872fc86b462617c294
Version : 1.0.29
Build : make clang-debug-asan
```
### Proof of concept
[poc-2.wasm.zip](https://github.com/WebAssembly/wabt/files/9490159/poc-2.wasm.zip)
### Stack dump
```
=================================================================
==1704949==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x610000000010 at pc 0x0000005f2828 bp 0x7ffc769a3c60 sp 0x7ffc769a3c58
READ of size 4 at 0x610000000010 thread T0
#0 0x5f2827 in wabt::Node::operator=(wabt::Node&&) /wabt/out/clang/Debug/asan/../../../../src/decompiler-ast.h:67:17
#1 0x5dc955 in wabt::Node::Node(wabt::Node&&) /wabt/out/clang/Debug/asan/../../../../src/decompiler-ast.h:65:28
#2 0x5f54b0 in std::enable_if<__and_<std::__not_<std::__is_tuple_like<wabt::Node>>, std::is_move_constructible<wabt::Node>, std::is_move_assignable<wabt::Node>>::value, void>::type std::swap<wabt::Node>(wabt::Node&, wabt::Node&) /usr/lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/move.h:197:19
#3 0x5f501e in void std::iter_swap<__gnu_cxx::__normal_iterator<wabt::Node*, std::vector<wabt::Node, std::allocator<wabt::Node>>>, __gnu_cxx::__normal_iterator<wabt::Node*, std::vector<wabt::Node, std::allocator<wabt::Node>>>>(__gnu_cxx::__normal_iterator<wabt::Node*, std::vector<wabt::Node, std::allocator<wabt::Node>>>, __gnu_cxx::__normal_iterator<wabt::Node*, std::vector<wabt::Node, std::allocator<wabt::Node>>>) /usr/lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/stl_algobase.h:182:7
#4 0x5f46ed in __gnu_cxx::__normal_iterator<wabt::Node*, std::vector<wabt::Node, std::allocator<wabt::Node>>> std::_V2::__rotate<__gnu_cxx::__normal_iterator<wabt::Node*, std::vector<wabt::Node, std::allocator<wabt::Node>>>>(__gnu_cxx::__normal_iterator<wabt::Node*, std::vector<wabt::Node, std::allocator<wabt::Node>>>, __gnu_cxx::__normal_iterator<wabt::Node*, std::vector<wabt::Node, std::allocator<wabt::Node>>>, __gnu_cxx::__normal_iterator<wabt::Node*, std::vector<wabt::Node, std::allocator<wabt::Node>>>, std::random_access_iterator_tag) /usr/lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/stl_algo.h:1394:5
#5 0x5dd60f in __gnu_cxx::__normal_iterator<wabt::Node*, std::vector<wabt::Node, std::allocator<wabt::Node>>> std::_V2::rotate<__gnu_cxx::__normal_iterator<wabt::Node*, std::vector<wabt::Node, std::allocator<wabt::Node>>>>(__gnu_cxx::__normal_iterator<wabt::Node*, std::vector<wabt::Node, std::allocator<wabt::Node>>>, __gnu_cxx::__normal_iterator<wabt::Node*, std::vector<wabt::Node, std::allocator<wabt::Node>>>, __gnu_cxx::__normal_iterator<wabt::Node*, std::vector<wabt::Node, std::allocator<wabt::Node>>>) /usr/lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/stl_algo.h:1439:14
#6 0x5dd066 in wabt::AST::Construct(wabt::intrusive_list<wabt::Expr> const&, unsigned int, unsigned int, bool)::'lambda'(unsigned long)::operator()(unsigned long) const /wabt/out/clang/Debug/asan/../../../../src/decompiler-ast.h:279:11
#7 0x5c8556 in wabt::AST::Construct(wabt::intrusive_list<wabt::Expr> const&, unsigned int, unsigned int, bool) /wabt/out/clang/Debug/asan/../../../../src/decompiler-ast.h:307:13
#8 0x5ee577 in void wabt::AST::Block<(wabt::ExprType)8>(wabt::BlockExprBase<(wabt::ExprType)8> const&, wabt::LabelType) /wabt/out/clang/Debug/asan/../../../../src/decompiler-ast.h:159:5
#9 0x5dc2fd in wabt::AST::Construct(wabt::Expr const&) /wabt/out/clang/Debug/asan/../../../../src/decompiler-ast.h:212:9
#10 0x5c7b64 in wabt::AST::Construct(wabt::intrusive_list<wabt::Expr> const&, unsigned int, unsigned int, bool) /wabt/out/clang/Debug/asan/../../../../src/decompiler-ast.h:248:7
#11 0x5c281f in wabt::Decompiler::Decompile[abi:cxx11]() /wabt/out/clang/Debug/asan/../../../../src/decompiler.cc:795:13
#12 0x5be6bd in wabt::Decompile[abi:cxx11](wabt::Module const&, wabt::DecompileOptions const&) /wabt/out/clang/Debug/asan/../../../../src/decompiler.cc:854:21
#13 0x4f16bd in ProgramMain(int, char**) /wabt/out/clang/Debug/asan/../../../../src/tools/wasm-decompile.cc:103:18
#14 0x4f2101 in main /wabt/out/clang/Debug/asan/../../../../src/tools/wasm-decompile.cc:116:10
#15 0x7f9cae44d082 in __libc_start_main /build/glibc-SzIz7B/glibc-2.31/csu/../csu/libc-start.c:308:16
#16 0x43f04d in _start (/wabt/out/clang/Debug/asan/wasm-decompile+0x43f04d)
0x610000000010 is located 48 bytes to the left of 192-byte region [0x610000000040,0x610000000100)
allocated by thread T0 here:
#0 0x4edc5d in operator new(unsigned long) /home/build-user/llvm-project/compiler-rt/lib/asan/asan_new_delete.cpp:95:3
#1 0x5f05c8 in __gnu_cxx::new_allocator<wabt::Node>::allocate(unsigned long, void const*) /usr/lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/ext/new_allocator.h:115:27
#2 0x5f0570 in std::allocator_traits<std::allocator<wabt::Node>>::allocate(std::allocator<wabt::Node>&, unsigned long) /usr/lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/alloc_traits.h:460:20
#3 0x5effaf in std::_Vector_base<wabt::Node, std::allocator<wabt::Node>>::_M_allocate(unsigned long) /usr/lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/stl_vector.h:346:20
#4 0x5f3462 in void std::vector<wabt::Node, std::allocator<wabt::Node>>::_M_realloc_insert<wabt::Node>(__gnu_cxx::__normal_iterator<wabt::Node*, std::vector<wabt::Node, std::allocator<wabt::Node>>>, wabt::Node&&) /usr/lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/vector.tcc:440:33
#5 0x5f3124 in wabt::Node& std::vector<wabt::Node, std::allocator<wabt::Node>>::emplace_back<wabt::Node>(wabt::Node&&) /usr/lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/vector.tcc:121:4
#6 0x5dcbdc in std::vector<wabt::Node, std::allocator<wabt::Node>>::push_back(wabt::Node&&) /usr/lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/stl_vector.h:1204:9
#7 0x5de429 in wabt::AST::InsertNode(wabt::NodeType, wabt::ExprType, wabt::Expr const*, unsigned int) /wabt/out/clang/Debug/asan/../../../../src/decompiler-ast.h:104:15
#8 0x5dc5d0 in wabt::AST::Construct(wabt::Expr const&) /wabt/out/clang/Debug/asan/../../../../src/decompiler-ast.h:230:9
#9 0x5c7b64 in wabt::AST::Construct(wabt::intrusive_list<wabt::Expr> const&, unsigned int, unsigned int, bool) /wabt/out/clang/Debug/asan/../../../../src/decompiler-ast.h:248:7
#10 0x5ee577 in void wabt::AST::Block<(wabt::ExprType)8>(wabt::BlockExprBase<(wabt::ExprType)8> const&, wabt::LabelType) /wabt/out/clang/Debug/asan/../../../../src/decompiler-ast.h:159:5
#11 0x5dc2fd in wabt::AST::Construct(wabt::Expr const&) /wabt/out/clang/Debug/asan/../../../../src/decompiler-ast.h:212:9
#12 0x5c7b64 in wabt::AST::Construct(wabt::intrusive_list<wabt::Expr> const&, unsigned int, unsigned int, bool) /wabt/out/clang/Debug/asan/../../../../src/decompiler-ast.h:248:7
#13 0x5c281f in wabt::Decompiler::Decompile[abi:cxx11]() /wabt/out/clang/Debug/asan/../../../../src/decompiler.cc:795:13
#14 0x5be6bd in wabt::Decompile[abi:cxx11](wabt::Module const&, wabt::DecompileOptions const&) /wabt/out/clang/Debug/asan/../../../../src/decompiler.cc:854:21
#15 0x4f16bd in ProgramMain(int, char**) /wabt/out/clang/Debug/asan/../../../../src/tools/wasm-decompile.cc:103:18
#16 0x4f2101 in main /wabt/out/clang/Debug/asan/../../../../src/tools/wasm-decompile.cc:116:10
#17 0x7f9cae44d082 in __libc_start_main /build/glibc-SzIz7B/glibc-2.31/csu/../csu/libc-start.c:308:16
SUMMARY: AddressSanitizer: heap-buffer-overflow /wabt/out/clang/Debug/asan/../../../../src/decompiler-ast.h:67:17 in wabt::Node::operator=(wabt::Node&&)
Shadow bytes around the buggy address:
0x0c207fff7fb0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c207fff7fc0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c207fff7fd0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c207fff7fe0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c207fff7ff0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0x0c207fff8000: fa fa[fa]fa fa fa fa fa 00 00 00 00 00 00 00 00
0x0c207fff8010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c207fff8020: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c207fff8030: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c207fff8040: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c207fff8050: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
Shadow byte legend (one shadow byte represents 8 application bytes):
Addressable: 00
Partially addressable: 01 02 03 04 05 06 07
Heap left redzone: fa
Freed heap region: fd
Stack left redzone: f1
Stack mid redzone: f2
Stack right redzone: f3
Stack after return: f5
Stack use after scope: f8
Global redzone: f9
Global init order: f6
Poisoned by user: f7
Container overflow: fc
Array cookie: ac
Intra object redzone: bb
ASan internal: fe
Left alloca redzone: ca
Right alloca redzone: cb
==1704949==ABORTING
```
|
heap overflow in wabt::Node::operator=(wabt::Node&&)
|
https://api.github.com/repos/WebAssembly/wabt/issues/1989/comments
| 1 |
2022-09-05T13:30:58Z
|
2023-03-17T12:04:27Z
|
https://github.com/WebAssembly/wabt/issues/1989
| 1,361,978,096 | 1,989 |
[
"WebAssembly",
"wabt"
] |
### Environment
```
OS : Linux ubuntu 5.15.0-46-generic #49~20.04.1-Ubuntu SMP Thu Aug 4 19:15:44 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
Commit : 3054d61f703d609995798f872fc86b462617c294
Version : 1.0.29
Build : make clang-debug-asan
```
### Proof of concept
[poc-1.wasm.zip](https://github.com/WebAssembly/wabt/files/9490146/poc-1.wasm.zip)
### Stack dump
```
AddressSanitizer:DEADLYSIGNAL
=================================================================
==2668973==ERROR: AddressSanitizer: SEGV on unknown address 0x60ffffffffe0 (pc 0x0000005f2830 bp 0x7ffc20391ac0 sp 0x7ffc20391a30 T0)
==2668973==The signal is caused by a READ memory access.
#0 0x5f2830 in wabt::Node::operator=(wabt::Node&&) /wabt/out/clang/Debug/asan/../../../../src/decompiler-ast.h:67:17
#1 0x5dc955 in wabt::Node::Node(wabt::Node&&) /wabt/out/clang/Debug/asan/../../../../src/decompiler-ast.h:65:28
#2 0x5f54b0 in std::enable_if<__and_<std::__not_<std::__is_tuple_like<wabt::Node>>, std::is_move_constructible<wabt::Node>, std::is_move_assignable<wabt::Node>>::value, void>::type std::swap<wabt::Node>(wabt::Node&, wabt::Node&) /usr/lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/move.h:197:19
#3 0x5f501e in void std::iter_swap<__gnu_cxx::__normal_iterator<wabt::Node*, std::vector<wabt::Node, std::allocator<wabt::Node>>>, __gnu_cxx::__normal_iterator<wabt::Node*, std::vector<wabt::Node, std::allocator<wabt::Node>>>>(__gnu_cxx::__normal_iterator<wabt::Node*, std::vector<wabt::Node, std::allocator<wabt::Node>>>, __gnu_cxx::__normal_iterator<wabt::Node*, std::vector<wabt::Node, std::allocator<wabt::Node>>>) /usr/lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/stl_algobase.h:182:7
#4 0x5f4bea in __gnu_cxx::__normal_iterator<wabt::Node*, std::vector<wabt::Node, std::allocator<wabt::Node>>> std::swap_ranges<__gnu_cxx::__normal_iterator<wabt::Node*, std::vector<wabt::Node, std::allocator<wabt::Node>>>, __gnu_cxx::__normal_iterator<wabt::Node*, std::vector<wabt::Node, std::allocator<wabt::Node>>>>(__gnu_cxx::__normal_iterator<wabt::Node*, std::vector<wabt::Node, std::allocator<wabt::Node>>>, __gnu_cxx::__normal_iterator<wabt::Node*, std::vector<wabt::Node, std::allocator<wabt::Node>>>, __gnu_cxx::__normal_iterator<wabt::Node*, std::vector<wabt::Node, std::allocator<wabt::Node>>>) /usr/lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/stl_algobase.h:212:2
#5 0x5f3f8e in __gnu_cxx::__normal_iterator<wabt::Node*, std::vector<wabt::Node, std::allocator<wabt::Node>>> std::_V2::__rotate<__gnu_cxx::__normal_iterator<wabt::Node*, std::vector<wabt::Node, std::allocator<wabt::Node>>>>(__gnu_cxx::__normal_iterator<wabt::Node*, std::vector<wabt::Node, std::allocator<wabt::Node>>>, __gnu_cxx::__normal_iterator<wabt::Node*, std::vector<wabt::Node, std::allocator<wabt::Node>>>, __gnu_cxx::__normal_iterator<wabt::Node*, std::vector<wabt::Node, std::allocator<wabt::Node>>>, std::random_access_iterator_tag) /usr/lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/stl_algo.h:1347:4
#6 0x5dd60f in __gnu_cxx::__normal_iterator<wabt::Node*, std::vector<wabt::Node, std::allocator<wabt::Node>>> std::_V2::rotate<__gnu_cxx::__normal_iterator<wabt::Node*, std::vector<wabt::Node, std::allocator<wabt::Node>>>>(__gnu_cxx::__normal_iterator<wabt::Node*, std::vector<wabt::Node, std::allocator<wabt::Node>>>, __gnu_cxx::__normal_iterator<wabt::Node*, std::vector<wabt::Node, std::allocator<wabt::Node>>>, __gnu_cxx::__normal_iterator<wabt::Node*, std::vector<wabt::Node, std::allocator<wabt::Node>>>) /usr/lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/stl_algo.h:1439:14
#7 0x5dd066 in wabt::AST::Construct(wabt::intrusive_list<wabt::Expr> const&, unsigned int, unsigned int, bool)::'lambda'(unsigned long)::operator()(unsigned long) const /wabt/out/clang/Debug/asan/../../../../src/decompiler-ast.h:279:11
#8 0x5c8556 in wabt::AST::Construct(wabt::intrusive_list<wabt::Expr> const&, unsigned int, unsigned int, bool) /wabt/out/clang/Debug/asan/../../../../src/decompiler-ast.h:307:13
#9 0x5ee577 in void wabt::AST::Block<(wabt::ExprType)8>(wabt::BlockExprBase<(wabt::ExprType)8> const&, wabt::LabelType) /wabt/out/clang/Debug/asan/../../../../src/decompiler-ast.h:159:5
#10 0x5dc2fd in wabt::AST::Construct(wabt::Expr const&) /wabt/out/clang/Debug/asan/../../../../src/decompiler-ast.h:212:9
#11 0x5c7b64 in wabt::AST::Construct(wabt::intrusive_list<wabt::Expr> const&, unsigned int, unsigned int, bool) /wabt/out/clang/Debug/asan/../../../../src/decompiler-ast.h:248:7
#12 0x5c281f in wabt::Decompiler::Decompile[abi:cxx11]() /wabt/out/clang/Debug/asan/../../../../src/decompiler.cc:795:13
#13 0x5be6bd in wabt::Decompile[abi:cxx11](wabt::Module const&, wabt::DecompileOptions const&) /wabt/out/clang/Debug/asan/../../../../src/decompiler.cc:854:21
#14 0x4f16bd in ProgramMain(int, char**) /wabt/out/clang/Debug/asan/../../../../src/tools/wasm-decompile.cc:103:18
#15 0x4f2101 in main /wabt/out/clang/Debug/asan/../../../../src/tools/wasm-decompile.cc:116:10
#16 0x7f9ff05ef082 in __libc_start_main /build/glibc-SzIz7B/glibc-2.31/csu/../csu/libc-start.c:308:16
#17 0x43f04d in _start (/wabt/out/clang/Debug/asan/wasm-decompile+0x43f04d)
AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV /wabt/out/clang/Debug/asan/../../../../src/decompiler-ast.h:67:17 in wabt::Node::operator=(wabt::Node&&)
==2668973==ABORTING
```
|
SEGV in wabt::Node::operator=(wabt::Node&&)
|
https://api.github.com/repos/WebAssembly/wabt/issues/1988/comments
| 3 |
2022-09-05T13:29:09Z
|
2022-09-18T05:21:16Z
|
https://github.com/WebAssembly/wabt/issues/1988
| 1,361,974,973 | 1,988 |
[
"WebAssembly",
"wabt"
] |
### Environment
```
OS : Linux ubuntu 5.15.0-46-generic #49~20.04.1-Ubuntu SMP Thu Aug 4 19:15:44 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
Commit : 3054d61f703d609995798f872fc86b462617c294
Version : 1.0.29
Build : make clang-debug-asan
```
### Proof of concept
poc_wasm-validate.wasm
[poc_wasm-validate.wasm.zip](https://github.com/WebAssembly/wabt/files/9489985/poc_wasm-validate.wasm.zip)
### Stack dump
```
$ ./wasm-validate --enable-all poc_wasm-validate.wasm
wasm-validate: ../../../../src/type.h:132: wabt::Index wabt::Type::GetReferenceIndex() const: Assertion `enum_ == Enum::Reference' failed.
Aborted
$ gdb ./wasm-validate
pwndbg> r --enable-all ./8858c8fd6729859-id\:000000\,sig\:06\,src\:000000\,time\:152726\,execs\:15118\,op\:havoc\,rep\:4.wasm
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
wasm-validate: ../../../../src/type.h:132: wabt::Index wabt::Type::GetReferenceIndex() const: Assertion `enum_ == Enum::Reference' failed.
Program received signal SIGABRT, Aborted.
__GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
50 ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
LEGEND: STACK | HEAP | CODE | DATA | RWX | RODATA
─────────────────────────────────────────────────────────────────────────────────[ REGISTERS ]──────────────────────────────────────────────────────────────────────────────────
RAX 0x0
RBX 0x7ffff7a357c0 ◂— 0x7ffff7a357c0
RCX 0x7ffff7a7b00b (raise+203) —▸ 0x10824848b48 ◂— 0x0
RDX 0x0
RDI 0x2
RSI 0x7fffffff8c30 ◂— 0x0
R8 0x0
R9 0x7fffffff8c30 ◂— 0x0
R10 0x8
R11 0x246
R12 0x785a80 (str) ◂— '../../../../src/type.h'
R13 0x84
R14 0x785a40 (str) ◂— 'enum_ == Enum::Reference'
R15 0x0
RBP 0x7ffff7bf0588 ◂— "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n"
RSP 0x7fffffff8c30 ◂— 0x0
RIP 0x7ffff7a7b00b (raise+203) —▸ 0x10824848b48 ◂— 0x0
───────────────────────────────────────────────────────────────────────────────────[ DISASM ]───────────────────────────────────────────────────────────────────────────────────
► 0x7ffff7a7b00b <raise+203> mov rax, qword ptr [rsp + 0x108]
0x7ffff7a7b013 <raise+211> xor rax, qword ptr fs:[0x28]
0x7ffff7a7b01c <raise+220> jne raise+260 <raise+260>
↓
0x7ffff7a7b044 <raise+260> call __stack_chk_fail <__stack_chk_fail>
0x7ffff7a7b049 nop dword ptr [rax]
0x7ffff7a7b050 <killpg> endbr64
0x7ffff7a7b054 <killpg+4> test edi, edi
0x7ffff7a7b056 <killpg+6> js killpg+16 <killpg+16>
0x7ffff7a7b058 <killpg+8> neg edi
0x7ffff7a7b05a <killpg+10> jmp kill <kill>
0x7ffff7a7b05f <killpg+15> nop
───────────────────────────────────────────────────────────────────────────────────[ STACK ]────────────────────────────────────────────────────────────────────────────────────
00:0000│ rsi r9 rsp 0x7fffffff8c30 ◂— 0x0
01:0008│ 0x7fffffff8c38 —▸ 0x4ba4d0 (free) ◂— push rbp
02:0010│ 0x7fffffff8c40 ◂— 0x7ffffbad8000
03:0018│ 0x7fffffff8c48 —▸ 0x612000000340 ◂— 0xc800001
04:0020│ 0x7fffffff8c50 —▸ 0x6120000003a5 ◂— "on `enum_ == Enum::Reference' failed.\n"
05:0028│ 0x7fffffff8c58 —▸ 0x612000000340 ◂— 0xc800001
06:0030│ 0x7fffffff8c60 —▸ 0x612000000340 ◂— 0xc800001
07:0038│ 0x7fffffff8c68 —▸ 0x6120000003cb ◂— 0x0
─────────────────────────────────────────────────────────────────────────────────[ BACKTRACE ]──────────────────────────────────────────────────────────────────────────────────
► f 0 0x7ffff7a7b00b raise+203
f 1 0x7ffff7a5a859 abort+299
f 2 0x7ffff7a5a729 _nl_load_domain.cold
f 3 0x7ffff7a6bfd6
f 4 0x7238c8
f 5 0x715885
f 6 0x6d93dd
f 7 0x5f912d
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
pwndbg> bt
#0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1 0x00007ffff7a5a859 in __GI_abort () at abort.c:79
#2 0x00007ffff7a5a729 in __assert_fail_base (fmt=0x7ffff7bf0588 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x785a40 <str> "enum_ == Enum::Reference", file=0x785a80 <str> "../../../../src/type.h", line=132, function=<optimized out>) at assert.c:92
#3 0x00007ffff7a6bfd6 in __GI___assert_fail (assertion=0x785a40 <str> "enum_ == Enum::Reference", file=0x785a80 <str> "../../../../src/type.h", line=132, function=0x785ac0 <__PRETTY_FUNCTION__._ZNK4wabt4Type17GetReferenceIndexEv> "wabt::Index wabt::Type::GetReferenceIndex() const") at assert.c:101
#4 0x00000000007238c8 in wabt::Type::GetReferenceIndex (this=0x7fffffff8f70) at ../../../../src/type.h:132
#5 0x0000000000715885 in wabt::TypeChecker::OnIndexedFuncRef (this=0x7fffffffd568, out_index=0x7fffffff9200) at ../../../../src/type-checker.cc:536
#6 0x00000000006d93dd in wabt::SharedValidator::OnCallRef (this=0x7fffffffd548, loc=..., function_type_index=0x7fffffff94b0) at ../../../../src/shared-validator.cc:706
#7 0x00000000005f912d in wabt::(anonymous namespace)::Validator::OnCallRefExpr (this=0x7fffffffd530, expr=0x60d000000380) at ../../../../src/validator.cc:281
#8 0x00000000006a82ba in wabt::ExprVisitor::HandleDefaultState (this=0x7fffffffc0f0, expr=0x60d000000380) at ../../../../src/expr-visitor.cc:219
#9 0x00000000006a408e in wabt::ExprVisitor::VisitExpr (this=0x7fffffffc0f0, root_expr=0x60d000000380) at ../../../../src/expr-visitor.cc:41
#10 0x00000000006adc5f in wabt::ExprVisitor::VisitExprList (this=0x7fffffffc0f0, exprs=...) at ../../../../src/expr-visitor.cc:148
#11 0x00000000005f33a8 in wabt::(anonymous namespace)::Validator::CheckModule (this=0x7fffffffd530) at ../../../../src/validator.cc:830
#12 0x00000000005ed6de in wabt::ValidateModule (module=0x7fffffffda10, errors=0x7fffffffd9d0, options=...) at ../../../../src/validator.cc:1044
#13 0x00000000004efb42 in ProgramMain (argc=3, argv=0x7fffffffe178) at ../../../../src/tools/wasm-validate.cc:88
#14 0x00000000004f01a2 in main (argc=3, argv=0x7fffffffe178) at ../../../../src/tools/wasm-validate.cc:97
#15 0x00007ffff7a5c083 in __libc_start_main (main=0x4f0180 <main(int, char**)>, argc=3, argv=0x7fffffffe178, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffe168) at ../csu/libc-start.c:308
#16 0x000000000043e00e in _start ()
```
|
Assertion `enum_ == Enum::Reference' failed at wasm-validate
|
https://api.github.com/repos/WebAssembly/wabt/issues/1987/comments
| 1 |
2022-09-05T13:01:21Z
|
2022-09-17T23:30:37Z
|
https://github.com/WebAssembly/wabt/issues/1987
| 1,361,925,343 | 1,987 |
[
"WebAssembly",
"wabt"
] |
### Environment
```
OS : Linux ubuntu 5.15.0-46-generic #49~20.04.1-Ubuntu SMP Thu Aug 4 19:15:44 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
Commit : 3054d61f703d609995798f872fc86b462617c294
Version : 1.0.29
Build : make clang-debug-asan
```
### Proof of concept
poc_wasm2wat.wasm
[poc_wasm2wat.wasm.zip](https://github.com/WebAssembly/wabt/files/9489979/poc_wasm2wat.wasm.zip)
### Stack dump
```
gdb /wabt/out/clang/Debug/asan/wasm2wat
pwndbg> r --enable-all ./poc.wasm
Starting program: /wabt/out/clang/Debug/asan/wasm2wat --enable-all ./poc.wasm
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
wasm2wat: ../../../../src/type.h:132: wabt::Index wabt::Type::GetReferenceIndex() const: Assertion `enum_ == Enum::Reference' failed.
Program received signal SIGABRT, Aborted.
__GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
50 ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
LEGEND: STACK | HEAP | CODE | DATA | RWX | RODATA
─────────────────────────────────────────────────────────────────────────────────[ REGISTERS ]──────────────────────────────────────────────────────────────────────────────────
RAX 0x0
RBX 0x7ffff7a357c0 ◂— 0x7ffff7a357c0
RCX 0x7ffff7a7b00b (raise+203) —▸ 0x10824848b48 ◂— 0x0
RDX 0x0
RDI 0x2
RSI 0x7fffffff8b70 ◂— 0x0
R8 0x0
R9 0x7fffffff8b70 ◂— 0x0
R10 0x8
R11 0x246
R12 0x7e5b60 (str) ◂— '../../../../src/type.h'
R13 0x84
R14 0x7e5b20 (str) ◂— 'enum_ == Enum::Reference'
R15 0x0
RBP 0x7ffff7bf0588 ◂— "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n"
RSP 0x7fffffff8b70 ◂— 0x0
RIP 0x7ffff7a7b00b (raise+203) —▸ 0x10824848b48 ◂— 0x0
───────────────────────────────────────────────────────────────────────────────────[ DISASM ]───────────────────────────────────────────────────────────────────────────────────
► 0x7ffff7a7b00b <raise+203> mov rax, qword ptr [rsp + 0x108]
0x7ffff7a7b013 <raise+211> xor rax, qword ptr fs:[0x28]
0x7ffff7a7b01c <raise+220> jne raise+260 <raise+260>
↓
0x7ffff7a7b044 <raise+260> call __stack_chk_fail <__stack_chk_fail>
0x7ffff7a7b049 nop dword ptr [rax]
0x7ffff7a7b050 <killpg> endbr64
0x7ffff7a7b054 <killpg+4> test edi, edi
0x7ffff7a7b056 <killpg+6> js killpg+16 <killpg+16>
0x7ffff7a7b058 <killpg+8> neg edi
0x7ffff7a7b05a <killpg+10> jmp kill <kill>
0x7ffff7a7b05f <killpg+15> nop
───────────────────────────────────────────────────────────────────────────────────[ STACK ]────────────────────────────────────────────────────────────────────────────────────
00:0000│ rsi r9 rsp 0x7fffffff8b70 ◂— 0x0
01:0008│ 0x7fffffff8b78 —▸ 0x4ba570 (free) ◂— push rbp
02:0010│ 0x7fffffff8b80 ◂— 0x7562205dfbad8000
03:0018│ 0x7fffffff8b88 —▸ 0x612000000340 ◂— 0x52800001
04:0020│ 0x7fffffff8b90 —▸ 0x6120000003a5 ◂— "num_ == Enum::Reference' failed.\n"
05:0028│ 0x7fffffff8b98 —▸ 0x612000000340 ◂— 0x52800001
06:0030│ 0x7fffffff8ba0 —▸ 0x612000000340 ◂— 0x52800001
07:0038│ 0x7fffffff8ba8 —▸ 0x6120000003c6 ◂— 0x0
─────────────────────────────────────────────────────────────────────────────────[ BACKTRACE ]──────────────────────────────────────────────────────────────────────────────────
► f 0 0x7ffff7a7b00b raise+203
f 1 0x7ffff7a5a859 abort+299
f 2 0x7ffff7a5a729 _nl_load_domain.cold
f 3 0x7ffff7a6bfd6
f 4 0x779a68
f 5 0x76bd05
f 6 0x72fc4d
f 7 0x62d45d
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
pwndbg> bt
#0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1 0x00007ffff7a5a859 in __GI_abort () at abort.c:79
#2 0x00007ffff7a5a729 in __assert_fail_base (fmt=0x7ffff7bf0588 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x7e5b20 <str> "enum_ == Enum::Reference", file=0x7e5b60 <str> "../../../../src/type.h", line=132, function=<optimized out>) at assert.c:92
#3 0x00007ffff7a6bfd6 in __GI___assert_fail (assertion=0x7e5b20 <str> "enum_ == Enum::Reference", file=0x7e5b60 <str> "../../../../src/type.h", line=132, function=0x7e5ba0 <__PRETTY_FUNCTION__._ZNK4wabt4Type17GetReferenceIndexEv> "wabt::Index wabt::Type::GetReferenceIndex() const") at assert.c:101
#4 0x0000000000779a68 in wabt::Type::GetReferenceIndex (this=0x7fffffff8eb0) at ../../../../src/type.h:132
#5 0x000000000076bd05 in wabt::TypeChecker::OnIndexedFuncRef (this=0x7fffffffd4a8, out_index=0x7fffffff9140) at ../../../../src/type-checker.cc:536
#6 0x000000000072fc4d in wabt::SharedValidator::OnCallRef (this=0x7fffffffd488, loc=..., function_type_index=0x7fffffff93f0) at ../../../../src/shared-validator.cc:706
#7 0x000000000062d45d in wabt::(anonymous namespace)::Validator::OnCallRefExpr (this=0x7fffffffd470, expr=0x60d000000110) at ../../../../src/validator.cc:281
#8 0x00000000005c666a in wabt::ExprVisitor::HandleDefaultState (this=0x7fffffffc030, expr=0x60d000000110) at ../../../../src/expr-visitor.cc:219
#9 0x00000000005c243e in wabt::ExprVisitor::VisitExpr (this=0x7fffffffc030, root_expr=0x60d000000110) at ../../../../src/expr-visitor.cc:41
#10 0x00000000005cc00f in wabt::ExprVisitor::VisitExprList (this=0x7fffffffc030, exprs=...) at ../../../../src/expr-visitor.cc:148
#11 0x00000000006276d8 in wabt::(anonymous namespace)::Validator::CheckModule (this=0x7fffffffd470) at ../../../../src/validator.cc:830
#12 0x0000000000621a0e in wabt::ValidateModule (module=0x7fffffffd950, errors=0x7fffffffd910, options=...) at ../../../../src/validator.cc:1044
#13 0x00000000004efd87 in ProgramMain (argc=3, argv=0x7fffffffe218) at ../../../../src/tools/wasm2wat.cc:120
#14 0x00000000004f0af2 in main (argc=3, argv=0x7fffffffe218) at ../../../../src/tools/wasm2wat.cc:147
#15 0x00007ffff7a5c083 in __libc_start_main (main=0x4f0ad0 <main(int, char**)>, argc=3, argv=0x7fffffffe218, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffe208) at ../csu/libc-start.c:308
#16 0x000000000043e0ae in _start ()
```
|
Assertion `enum_ == Enum::Reference' failed at wasm2wat
|
https://api.github.com/repos/WebAssembly/wabt/issues/1986/comments
| 1 |
2022-09-05T13:00:04Z
|
2022-09-17T23:28:33Z
|
https://github.com/WebAssembly/wabt/issues/1986
| 1,361,923,206 | 1,986 |
[
"WebAssembly",
"wabt"
] |
### Environment
```
OS : Linux ubuntu 5.15.0-46-generic #49~20.04.1-Ubuntu SMP Thu Aug 4 19:15:44 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
Commit : 3054d61f703d609995798f872fc86b462617c294
Version : 1.0.29
Build : make clang-debug-asan
```
### Proof of concept
poc_wasm2c-1.wasm
[poc_wasm2c-1.wasm.zip](https://github.com/WebAssembly/wabt/files/9489964/poc_wasm2c-1.wasm.zip)
### Stack dump
```
gdb /wabt/out/clang/Debug/asan/wasm2c
pwndbg> r --enable-multi-memory ./poc_wasm2c-1.wasm
context:
LEGEND: STACK | HEAP | CODE | DATA | RWX | RODATA
─────────────────────────────────[ REGISTERS ]──────────────────────────────────
RAX 0x0
*RBX 0x7ffff7a357c0 ◂— 0x7ffff7a357c0
*RCX 0x7ffff7a7b00b (raise+203) —▸ 0x10824848b48 ◂— 0x0
RDX 0x0
*RDI 0x2
*RSI 0x7fffffff6990 ◂— 0x0
R8 0x0
*R9 0x7fffffff6990 ◂— 0x0
*R10 0x8
*R11 0x246
*R12 0x43e420 (_start) ◂— endbr64
*R13 0x7fffffffe070 ◂— 0x3
R14 0x0
R15 0x0
*RBP 0x7fffffff88f0 —▸ 0x7fffffff8930 —▸ 0x7fffffffa650 —▸ 0x7fffffffa690 —▸ 0x7fffffffc3c0 ◂— ...
*RSP 0x7fffffff6990 ◂— 0x0
*RIP 0x7ffff7a7b00b (raise+203) —▸ 0x10824848b48 ◂— 0x0
───────────────────────────────────[ DISASM ]───────────────────────────────────
► 0x7ffff7a7b00b <raise+203> mov rax, qword ptr [rsp + 0x108]
0x7ffff7a7b013 <raise+211> xor rax, qword ptr fs:[0x28]
0x7ffff7a7b01c <raise+220> jne raise+260 <raise+260>
↓
0x7ffff7a7b044 <raise+260> call __stack_chk_fail <__stack_chk_fail>
0x7ffff7a7b049 nop dword ptr [rax]
0x7ffff7a7b050 <killpg> endbr64
0x7ffff7a7b054 <killpg+4> test edi, edi
0x7ffff7a7b056 <killpg+6> js killpg+16 <killpg+16>
0x7ffff7a7b058 <killpg+8> neg edi
0x7ffff7a7b05a <killpg+10> jmp kill <kill>
0x7ffff7a7b05f <killpg+15> nop
───────────────────────────────────[ STACK ]────────────────────────────────────
00:0000│ rsi r9 rsp 0x7fffffff6990 ◂— 0x0
01:0008│ 0x7fffffff6998 ◂— '(ut)(x))unimplemented: %'
02:0010│ 0x7fffffff69a0 ◂— 'unimplemented: %'
03:0018│ 0x7fffffff69a8 ◂— 'ented: %'
04:0020│ 0x7fffffff69b0 ◂— 0x0
... ↓ 3 skipped
─────────────────────────────────[ BACKTRACE ]──────────────────────────────────
► f 0 0x7ffff7a7b00b raise+203
f 1 0x7ffff7a5a859 abort+299
f 2 0x52769e
f 3 0x5315c3
f 4 0x52760d
f 5 0x5315c3
f 6 0x52760d
f 7 0x51dd51
────────────────────────────────────────────────────────────────────────────────
backtrace_msg:
#0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1 0x00007ffff7a5a859 in __GI_abort () at abort.c:79
#2 0x000000000052769e in wabt::(anonymous namespace)::CWriter::Write (this=0x7fffffffce30, exprs=...) at ../../../../src/c-writer.cc:1969
#3 0x00000000005315c3 in wabt::(anonymous namespace)::CWriter::Write<wabt::(anonymous namespace)::Newline, wabt::intrusive_list<wabt::Expr> const&> (this=0x7fffffffce30, t=..., u=...) at ../../../../src/c-writer.cc:205
#4 0x000000000052760d in wabt::(anonymous namespace)::CWriter::Write (this=0x7fffffffce30, exprs=...) at ../../../../src/c-writer.cc:1945
#5 0x00000000005315c3 in wabt::(anonymous namespace)::CWriter::Write<wabt::(anonymous namespace)::Newline, wabt::intrusive_list<wabt::Expr> const&> (this=0x7fffffffce30, t=..., u=...) at ../../../../src/c-writer.cc:205
#6 0x000000000052760d in wabt::(anonymous namespace)::CWriter::Write (this=0x7fffffffce30, exprs=...) at ../../../../src/c-writer.cc:1945
#7 0x000000000051dd51 in wabt::(anonymous namespace)::CWriter::Write<wabt::intrusive_list<wabt::Expr> const&, wabt::(anonymous namespace)::LabelDecl> (this=0x7fffffffce30, t=..., u=...) at ../../../../src/c-writer.cc:204
#8 0x000000000051bd15 in wabt::(anonymous namespace)::CWriter::Write (this=0x7fffffffce30, func=...) at ../../../../src/c-writer.cc:1423
#9 0x000000000051b647 in wabt::(anonymous namespace)::CWriter::Write<wabt::(anonymous namespace)::Newline, wabt::Func const&, wabt::(anonymous namespace)::Newline> (this=0x7fffffffce30, t=..., u=..., args=...) at ../../../../src/c-writer.cc:205
#10 0x000000000051182d in wabt::(anonymous namespace)::CWriter::WriteFuncs (this=0x7fffffffce30) at ../../../../src/c-writer.cc:1393
#11 0x0000000000500bf4 in wabt::(anonymous namespace)::CWriter::WriteCSource (this=0x7fffffffce30) at ../../../../src/c-writer.cc:2794
#12 0x00000000004ffcd7 in wabt::(anonymous namespace)::CWriter::WriteModule (this=0x7fffffffce30, module=...) at ../../../../src/c-writer.cc:2807
#13 0x00000000004ff48d in wabt::WriteC (c_stream=0x7fffffffdaa0, h_stream=0x7fffffffdaa0, header_name=0x7ccce0 <str> "wasm.h", module=0x7fffffffd2b0, options=...) at ../../../../src/c-writer.cc:2819
#14 0x00000000004f11b4 in ProgramMain (argc=3, argv=0x7fffffffe078) at ../../../../src/tools/wasm2c.cc:179
#15 0x00000000004f37f2 in main (argc=3, argv=0x7fffffffe078) at ../../../../src/tools/wasm2c.cc:190
#16 0x00007ffff7a5c083 in __libc_start_main (main=0x4f37d0 <main(int, char**)>, argc=3, argv=0x7fffffffe078, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffe068) at ../csu/libc-start.c:308
#17 0x000000000043e44e in _start ()
```
|
Aborted in CWriter::Write at wasm2c
|
https://api.github.com/repos/WebAssembly/wabt/issues/1985/comments
| 1 |
2022-09-05T12:58:25Z
|
2022-10-03T06:27:37Z
|
https://github.com/WebAssembly/wabt/issues/1985
| 1,361,920,430 | 1,985 |
[
"WebAssembly",
"wabt"
] |
### Title
Aborted in CWriter::MangleType at wasm2c
### Environment
```
OS : Linux ubuntu 5.15.0-46-generic #49~20.04.1-Ubuntu SMP Thu Aug 4 19:15:44 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
Commit : 3054d61f703d609995798f872fc86b462617c294
Version : 1.0.29
Build : make clang-debug-asan
```
### Proof of concept
poc.wasm2c-2.wasm
[poc_wasm2c-2.wasm.zip](https://github.com/WebAssembly/wabt/files/9490006/poc_wasm2c-2.wasm.zip)
### Stack dump
```
gdb /wabt/out/clang/Debug/asan/wasm2c
pwndbg> r --enable-multi-memory ./poc.wasm2c-2.wasm
context:
LEGEND: STACK | HEAP | CODE | DATA | RWX | RODATA
─────────────────────────────────[ REGISTERS ]──────────────────────────────────
RAX 0x0
*RBX 0x7ffff7a357c0 ◂— 0x7ffff7a357c0
*RCX 0x7ffff7a7b00b (raise+203) —▸ 0x10824848b48 ◂— 0x0
RDX 0x0
*RDI 0x2
*RSI 0x7fffffff9a90 ◂— 0x0
R8 0x0
*R9 0x7fffffff9a90 ◂— 0x0
*R10 0x8
*R11 0x246
*R12 0x43e420 (_start) ◂— endbr64
*R13 0x7fffffffe070 ◂— 0x3
R14 0x0
R15 0x0
*RBP 0x7fffffff9df0 —▸ 0x7fffffffa270 —▸ 0x7fffffffa3c0 —▸ 0x7fffffffa690 —▸ 0x7fffffffc3c0 ◂— ...
*RSP 0x7fffffff9a90 ◂— 0x0
*RIP 0x7ffff7a7b00b (raise+203) —▸ 0x10824848b48 ◂— 0x0
───────────────────────────────────[ DISASM ]───────────────────────────────────
► 0x7ffff7a7b00b <raise+203> mov rax, qword ptr [rsp + 0x108]
0x7ffff7a7b013 <raise+211> xor rax, qword ptr fs:[0x28]
0x7ffff7a7b01c <raise+220> jne raise+260 <raise+260>
↓
0x7ffff7a7b044 <raise+260> call __stack_chk_fail <__stack_chk_fail>
0x7ffff7a7b049 nop dword ptr [rax]
0x7ffff7a7b050 <killpg> endbr64
0x7ffff7a7b054 <killpg+4> test edi, edi
0x7ffff7a7b056 <killpg+6> js killpg+16 <killpg+16>
0x7ffff7a7b058 <killpg+8> neg edi
0x7ffff7a7b05a <killpg+10> jmp kill <kill>
0x7ffff7a7b05f <killpg+15> nop
───────────────────────────────────[ STACK ]────────────────────────────────────
00:0000│ rsi r9 rsp 0x7fffffff9a90 ◂— 0x0
01:0008│ 0x7fffffff9a98 ◂— 0xfffffffffffffffb
02:0010│ 0x7fffffff9aa0 —▸ 0x757525 ◂— cli
03:0018│ 0x7fffffff9aa8 ◂— 0x0
... ↓ 4 skipped
─────────────────────────────────[ BACKTRACE ]──────────────────────────────────
► f 0 0x7ffff7a7b00b raise+203
f 1 0x7ffff7a5a859 abort+299
f 2 0x5074f0
f 3 0x52cebf
f 4 0x545a44
f 5 0x535a2f
f 6 0x528543
f 7 0x51dd51
────────────────────────────────────────────────────────────────────────────────
backtrace_msg:
#0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1 0x00007ffff7a5a859 in __GI_abort () at abort.c:79
#2 0x00000000005074f0 in wabt::(anonymous namespace)::CWriter::MangleType (type=...) at ../../../../src/c-writer.cc:427
#3 0x000000000052cebf in wabt::(anonymous namespace)::CWriter::Write (this=0x7fffffffce30, sv=...) at ../../../../src/c-writer.cc:701
#4 0x0000000000545a44 in wabt::(anonymous namespace)::CWriter::Write<wabt::(anonymous namespace)::StackVar, char const (&) [4], char const*, char const (&) [2], wabt::(anonymous namespace)::Name<2>, char const (&) [9], wabt::(anonymous namespace)::StackVar> (this=0x7fffffffce30, t=..., u=..., args=..., args=..., args=..., args=..., args=...) at ../../../../src/c-writer.cc:204
#5 0x0000000000535a2f in wabt::(anonymous namespace)::CWriter::Write (this=0x7fffffffce30, expr=warning: RTTI symbol not found for class 'wabt::LoadStoreExpr<(wabt::ExprType)47>'
...) at ../../../../src/c-writer.cc:2752
#6 0x0000000000528543 in wabt::(anonymous namespace)::CWriter::Write (this=0x7fffffffce30, exprs=...) at ../../../../src/c-writer.cc:2043
#7 0x000000000051dd51 in wabt::(anonymous namespace)::CWriter::Write<wabt::intrusive_list<wabt::Expr> const&, wabt::(anonymous namespace)::LabelDecl> (this=0x7fffffffce30, t=..., u=...) at ../../../../src/c-writer.cc:204
#8 0x000000000051bd15 in wabt::(anonymous namespace)::CWriter::Write (this=0x7fffffffce30, func=...) at ../../../../src/c-writer.cc:1423
#9 0x000000000051b647 in wabt::(anonymous namespace)::CWriter::Write<wabt::(anonymous namespace)::Newline, wabt::Func const&, wabt::(anonymous namespace)::Newline> (this=0x7fffffffce30, t=..., u=..., args=...) at ../../../../src/c-writer.cc:205
#10 0x000000000051182d in wabt::(anonymous namespace)::CWriter::WriteFuncs (this=0x7fffffffce30) at ../../../../src/c-writer.cc:1393
#11 0x0000000000500bf4 in wabt::(anonymous namespace)::CWriter::WriteCSource (this=0x7fffffffce30) at ../../../../src/c-writer.cc:2794
#12 0x00000000004ffcd7 in wabt::(anonymous namespace)::CWriter::WriteModule (this=0x7fffffffce30, module=...) at ../../../../src/c-writer.cc:2807
#13 0x00000000004ff48d in wabt::WriteC (c_stream=0x7fffffffdaa0, h_stream=0x7fffffffdaa0, header_name=0x7ccce0 <str> "wasm.h", module=0x7fffffffd2b0, options=...) at ../../../../src/c-writer.cc:2819
#14 0x00000000004f11b4 in ProgramMain (argc=3, argv=0x7fffffffe078) at ../../../../src/tools/wasm2c.cc:179
#15 0x00000000004f37f2 in main (argc=3, argv=0x7fffffffe078) at ../../../../src/tools/wasm2c.cc:190
#16 0x00007ffff7a5c083 in __libc_start_main (main=0x4f37d0 <main(int, char**)>, argc=3, argv=0x7fffffffe078, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffe068) at ../csu/libc-start.c:308
#17 0x000000000043e44e in _start ()
```
|
Aborted in CWriter::MangleType at wasm2c
|
https://api.github.com/repos/WebAssembly/wabt/issues/1984/comments
| 5 |
2022-09-05T12:57:12Z
|
2023-03-17T16:55:00Z
|
https://github.com/WebAssembly/wabt/issues/1984
| 1,361,918,475 | 1,984 |
[
"WebAssembly",
"wabt"
] |
### Environment
```
OS : Linux ubuntu 5.15.0-46-generic #49~20.04.1-Ubuntu SMP Thu Aug 4 19:15:44 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
Commit : 3054d61f703d609995798f872fc86b462617c294
Version : 1.0.29
Build : make clang-debug-asan
```
### Proof of concept
poc-interp-3.wasm
[poc-interp-3.wasm.zip](https://github.com/WebAssembly/wabt/files/9489918/poc-interp-3.wasm.zip)
### Stack dump
```
/wabt/out/clang/Debug/asan/wasm-interp --enable-all ./poc-interp-3.wasm
AddressSanitizer:DEADLYSIGNAL
=================================================================
==1491197==ERROR: AddressSanitizer: SEGV on unknown address 0x60600008bb58 (pc 0x000000509b3e bp 0x7ffe9a810b70 sp 0x7ffe9a810b40 T0)
==1491197==The signal is caused by a READ memory access.
#0 0x509b3e in std::vector<wabt::Type, std::allocator<wabt::Type>>::size() const /usr/lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/stl_vector.h:919:40
#1 0x576a36 in wabt::interp::(anonymous namespace)::BinaryReaderInterp::GetReturnCallDropKeepCount(wabt::interp::FuncType const&, unsigned int, unsigned int*, unsigned int*) /wabt/out/clang/Debug/asan/../../../../src/interp/binary-reader-interp.cc:445:58
#2 0x56955c in wabt::interp::(anonymous namespace)::BinaryReaderInterp::OnReturnCallIndirectExpr(unsigned int, unsigned int) /wabt/out/clang/Debug/asan/../../../../src/interp/binary-reader-interp.cc:1176:3
#3 0x6ead11 in wabt::(anonymous namespace)::BinaryReader::ReadInstructions(bool, unsigned long, wabt::Opcode*) /wabt/out/clang/Debug/asan/../../../../src/binary-reader.cc:937:9
#4 0x6ff84e in wabt::(anonymous namespace)::BinaryReader::ReadFunctionBody(unsigned long) /wabt/out/clang/Debug/asan/../../../../src/binary-reader.cc:667:3
#5 0x6c2f98 in wabt::(anonymous namespace)::BinaryReader::ReadCodeSection(unsigned long) /wabt/out/clang/Debug/asan/../../../../src/binary-reader.cc:2766:7
#6 0x6b0861 in wabt::(anonymous namespace)::BinaryReader::ReadSections(wabt::(anonymous namespace)::BinaryReader::ReadSectionsOptions const&) /wabt/out/clang/Debug/asan/../../../../src/binary-reader.cc:2920:26
#7 0x6ada2f in wabt::(anonymous namespace)::BinaryReader::ReadModule(wabt::(anonymous namespace)::BinaryReader::ReadModuleOptions const&) /wabt/out/clang/Debug/asan/../../../../src/binary-reader.cc:2981:3
#8 0x6aca08 in wabt::ReadBinary(void const*, unsigned long, wabt::BinaryReaderDelegate*, wabt::ReadBinaryOptions const&) /wabt/out/clang/Debug/asan/../../../../src/binary-reader.cc:2998:17
#9 0x54f132 in wabt::interp::ReadBinaryInterp(std::basic_string_view<char, std::char_traits<char>>, void const*, unsigned long, wabt::ReadBinaryOptions const&, std::vector<wabt::Error, std::allocator<wabt::Error>>*, wabt::interp::ModuleDesc*) /wabt/out/clang/Debug/asan/../../../../src/interp/binary-reader-interp.cc:1603:10
#10 0x4f6aed in ReadModule(char const*, std::vector<wabt::Error, std::allocator<wabt::Error>>*, wabt::interp::RefPtr<wabt::interp::Module>*) /wabt/out/clang/Debug/asan/../../../../src/tools/wasm-interp.cc:207:3
#11 0x4f100a in ReadAndRunModule(char const*) /wabt/out/clang/Debug/asan/../../../../src/tools/wasm-interp.cc:234:19
#12 0x4f0427 in ProgramMain(int, char**) /wabt/out/clang/Debug/asan/../../../../src/tools/wasm-interp.cc:329:25
#13 0x4f14a1 in main /wabt/out/clang/Debug/asan/../../../../src/tools/wasm-interp.cc:335:10
#14 0x7fa32b622082 in __libc_start_main /build/glibc-SzIz7B/glibc-2.31/csu/../csu/libc-start.c:308:16
#15 0x43e39d in _start (/wabt/out/clang/Debug/asan/wasm-interp+0x43e39d)
AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV /usr/lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/stl_vector.h:919:40 in std::vector<wabt::Type, std::allocator<wabt::Type>>::size() const
==1491197==ABORTING
```
|
Out-of-bound read in OnReturnCallIndirectExpr->GetReturnCallDropKeepCount
|
https://api.github.com/repos/WebAssembly/wabt/issues/1983/comments
| 1 |
2022-09-05T12:51:24Z
|
2022-09-17T19:15:54Z
|
https://github.com/WebAssembly/wabt/issues/1983
| 1,361,907,936 | 1,983 |
[
"WebAssembly",
"wabt"
] |
### Environment
```
OS : Linux ubuntu 5.15.0-46-generic #49~20.04.1-Ubuntu SMP Thu Aug 4 19:15:44 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
Commit : 3054d61f703d609995798f872fc86b462617c294
Version : 1.0.29
Build : make clang-debug-asan
```
### Proof of concept
poc-interp-2.wasm
[poc-interp-2.wasm.zip](https://github.com/WebAssembly/wabt/files/9489916/poc-interp-2.wasm.zip)
### Stack dump
```
/wabt/out/clang/Debug/asan/wasm-interp --enable-all ./poc-interp-2.wasm
AddressSanitizer:DEADLYSIGNAL
=================================================================
==1655959==ERROR: AddressSanitizer: SEGV on unknown address 0x606000018258 (pc 0x000000509b3e bp 0x7ffc2dca9870 sp 0x7ffc2dca9840 T0)
==1655959==The signal is caused by a READ memory access.
#0 0x509b3e in std::vector<wabt::Type, std::allocator<wabt::Type>>::size() const /usr/lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/stl_vector.h:919:40
#1 0x576a36 in wabt::interp::(anonymous namespace)::BinaryReaderInterp::GetReturnCallDropKeepCount(wabt::interp::FuncType const&, unsigned int, unsigned int*, unsigned int*) /wabt/out/clang/Debug/asan/../../../../src/interp/binary-reader-interp.cc:445:58
#2 0x568b24 in wabt::interp::(anonymous namespace)::BinaryReaderInterp::OnReturnCallExpr(unsigned int) /wabt/out/clang/Debug/asan/../../../../src/interp/binary-reader-interp.cc:1145:3
#3 0x6ea3cc in wabt::(anonymous namespace)::BinaryReader::ReadInstructions(bool, unsigned long, wabt::Opcode*) /wabt/out/clang/Debug/asan/../../../../src/binary-reader.cc:919:9
#4 0x6ff84e in wabt::(anonymous namespace)::BinaryReader::ReadFunctionBody(unsigned long) /wabt/out/clang/Debug/asan/../../../../src/binary-reader.cc:667:3
#5 0x6c2f98 in wabt::(anonymous namespace)::BinaryReader::ReadCodeSection(unsigned long) /wabt/out/clang/Debug/asan/../../../../src/binary-reader.cc:2766:7
#6 0x6b0861 in wabt::(anonymous namespace)::BinaryReader::ReadSections(wabt::(anonymous namespace)::BinaryReader::ReadSectionsOptions const&) /wabt/out/clang/Debug/asan/../../../../src/binary-reader.cc:2920:26
#7 0x6ada2f in wabt::(anonymous namespace)::BinaryReader::ReadModule(wabt::(anonymous namespace)::BinaryReader::ReadModuleOptions const&) /wabt/out/clang/Debug/asan/../../../../src/binary-reader.cc:2981:3
#8 0x6aca08 in wabt::ReadBinary(void const*, unsigned long, wabt::BinaryReaderDelegate*, wabt::ReadBinaryOptions const&) /wabt/out/clang/Debug/asan/../../../../src/binary-reader.cc:2998:17
#9 0x54f132 in wabt::interp::ReadBinaryInterp(std::basic_string_view<char, std::char_traits<char>>, void const*, unsigned long, wabt::ReadBinaryOptions const&, std::vector<wabt::Error, std::allocator<wabt::Error>>*, wabt::interp::ModuleDesc*) /wabt/out/clang/Debug/asan/../../../../src/interp/binary-reader-interp.cc:1603:10
#10 0x4f6aed in ReadModule(char const*, std::vector<wabt::Error, std::allocator<wabt::Error>>*, wabt::interp::RefPtr<wabt::interp::Module>*) /wabt/out/clang/Debug/asan/../../../../src/tools/wasm-interp.cc:207:3
#11 0x4f100a in ReadAndRunModule(char const*) /wabt/out/clang/Debug/asan/../../../../src/tools/wasm-interp.cc:234:19
#12 0x4f0427 in ProgramMain(int, char**) /wabt/out/clang/Debug/asan/../../../../src/tools/wasm-interp.cc:329:25
#13 0x4f14a1 in main /wabt/out/clang/Debug/asan/../../../../src/tools/wasm-interp.cc:335:10
#14 0x7f6273b8f082 in __libc_start_main /build/glibc-SzIz7B/glibc-2.31/csu/../csu/libc-start.c:308:16
#15 0x43e39d in _start (/wabt/out/clang/Debug/asan/wasm-interp+0x43e39d)
AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV /usr/lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/stl_vector.h:919:40 in std::vector<wabt::Type, std::allocator<wabt::Type>>::size() const
==1655959==ABORTING
```
|
Out-of-bound read in OnReturnCallExpr->GetReturnCallDropKeepCount
|
https://api.github.com/repos/WebAssembly/wabt/issues/1982/comments
| 1 |
2022-09-05T12:50:49Z
|
2022-09-17T19:13:47Z
|
https://github.com/WebAssembly/wabt/issues/1982
| 1,361,906,900 | 1,982 |
[
"WebAssembly",
"wabt"
] |
### Environment
```
OS : Linux ubuntu 5.15.0-46-generic #49~20.04.1-Ubuntu SMP Thu Aug 4 19:15:44 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
Commit : 3054d61f703d609995798f872fc86b462617c294
Version : 1.0.29
Build : make clang-debug-asan
```
### Proof of concept
poc-interp-1.wasm
[poc-interp-1.wasm.zip](https://github.com/WebAssembly/wabt/files/9489907/poc-interp-1.wasm.zip)
### Stack dump
```
/wabt/out/clang/Debug/asan/wasm-interp --enable-all ./poc-interp-1.wasm
=================================================================
==3163982==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60600000e318 at pc 0x000000509b36 bp 0x7ffeb0802e90 sp 0x7ffeb0802e88
READ of size 8 at 0x60600000e318 thread T0
#0 0x509b35 in std::vector<wabt::Type, std::allocator<wabt::Type>>::size() const /usr/lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/stl_vector.h:919:40
#1 0x576a36 in wabt::interp::(anonymous namespace)::BinaryReaderInterp::GetReturnCallDropKeepCount(wabt::interp::FuncType const&, unsigned int, unsigned int*, unsigned int*) /wabt/out/clang/Debug/asan/../../../../src/interp/binary-reader-interp.cc:445:58
#2 0x56955c in wabt::interp::(anonymous namespace)::BinaryReaderInterp::OnReturnCallIndirectExpr(unsigned int, unsigned int) /wabt/out/clang/Debug/asan/../../../../src/interp/binary-reader-interp.cc:1176:3
#3 0x6ead11 in wabt::(anonymous namespace)::BinaryReader::ReadInstructions(bool, unsigned long, wabt::Opcode*) /wabt/out/clang/Debug/asan/../../../../src/binary-reader.cc:937:9
#4 0x6ff84e in wabt::(anonymous namespace)::BinaryReader::ReadFunctionBody(unsigned long) /wabt/out/clang/Debug/asan/../../../../src/binary-reader.cc:667:3
#5 0x6c2f98 in wabt::(anonymous namespace)::BinaryReader::ReadCodeSection(unsigned long) /wabt/out/clang/Debug/asan/../../../../src/binary-reader.cc:2766:7
#6 0x6b0861 in wabt::(anonymous namespace)::BinaryReader::ReadSections(wabt::(anonymous namespace)::BinaryReader::ReadSectionsOptions const&) /wabt/out/clang/Debug/asan/../../../../src/binary-reader.cc:2920:26
#7 0x6ada2f in wabt::(anonymous namespace)::BinaryReader::ReadModule(wabt::(anonymous namespace)::BinaryReader::ReadModuleOptions const&) /wabt/out/clang/Debug/asan/../../../../src/binary-reader.cc:2981:3
#8 0x6aca08 in wabt::ReadBinary(void const*, unsigned long, wabt::BinaryReaderDelegate*, wabt::ReadBinaryOptions const&) /wabt/out/clang/Debug/asan/../../../../src/binary-reader.cc:2998:17
#9 0x54f132 in wabt::interp::ReadBinaryInterp(std::basic_string_view<char, std::char_traits<char>>, void const*, unsigned long, wabt::ReadBinaryOptions const&, std::vector<wabt::Error, std::allocator<wabt::Error>>*, wabt::interp::ModuleDesc*) /wabt/out/clang/Debug/asan/../../../../src/interp/binary-reader-interp.cc:1603:10
#10 0x4f6aed in ReadModule(char const*, std::vector<wabt::Error, std::allocator<wabt::Error>>*, wabt::interp::RefPtr<wabt::interp::Module>*) /wabt/out/clang/Debug/asan/../../../../src/tools/wasm-interp.cc:207:3
#11 0x4f100a in ReadAndRunModule(char const*) /wabt/out/clang/Debug/asan/../../../../src/tools/wasm-interp.cc:234:19
#12 0x4f0427 in ProgramMain(int, char**) /wabt/out/clang/Debug/asan/../../../../src/tools/wasm-interp.cc:329:25
#13 0x4f14a1 in main /wabt/out/clang/Debug/asan/../../../../src/tools/wasm-interp.cc:335:10
#14 0x7ff3cc7e6082 in __libc_start_main /build/glibc-SzIz7B/glibc-2.31/csu/../csu/libc-start.c:308:16
#15 0x43e39d in _start (/wabt/out/clang/Debug/asan/wasm-interp+0x43e39d)
Address 0x60600000e318 is a wild pointer inside of access range of size 0x000000000008.
SUMMARY: AddressSanitizer: heap-buffer-overflow /usr/lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/stl_vector.h:919:40 in std::vector<wabt::Type, std::allocator<wabt::Type>>::size() const
Shadow bytes around the buggy address:
0x0c0c7fff9c10: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c0c7fff9c20: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c0c7fff9c30: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c0c7fff9c40: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c0c7fff9c50: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
=>0x0c0c7fff9c60: fa fa fa[fa]fa fa fa fa fa fa fa fa fa fa fa fa
0x0c0c7fff9c70: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c0c7fff9c80: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c0c7fff9c90: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c0c7fff9ca0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c0c7fff9cb0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
Shadow byte legend (one shadow byte represents 8 application bytes):
Addressable: 00
Partially addressable: 01 02 03 04 05 06 07
Heap left redzone: fa
Freed heap region: fd
Stack left redzone: f1
Stack mid redzone: f2
Stack right redzone: f3
Stack after return: f5
Stack use after scope: f8
Global redzone: f9
Global init order: f6
Poisoned by user: f7
Container overflow: fc
Array cookie: ac
Intra object redzone: bb
ASan internal: fe
Left alloca redzone: ca
Right alloca redzone: cb
==3163982==ABORTING
```
|
heap overflow in wasm-interp
|
https://api.github.com/repos/WebAssembly/wabt/issues/1981/comments
| 1 |
2022-09-05T12:50:09Z
|
2022-09-17T19:11:15Z
|
https://github.com/WebAssembly/wabt/issues/1981
| 1,361,905,751 | 1,981 |
[
"WebAssembly",
"wabt"
] |
Even before my changes to the build (i.e. try on tag `1.0.29`) the code for running git-describe did nothing because of the following bogus check:
https://github.com/WebAssembly/wabt/blob/3054d61f703d609995798f872fc86b462617c294/CMakeLists.txt#L53-L55
On a tagged version like `1.0.29`, the `CMAKE_PROJECT_VERSION` variable is set to `1.0.29 (1.0.29)` (which is of dubious utility) just before this check runs. However, a quoted string always evaluates to false unless the string's value is one of the true constants. So this _always_ runs, so `CMAKE_PROJECT_VERSION` is _always_ reset to `PROJECT_VERSION`.
https://cmake.org/cmake/help/latest/command/if.html#basic-expressions
|
The git describe code does nothing
|
https://api.github.com/repos/WebAssembly/wabt/issues/1978/comments
| 0 |
2022-09-01T15:21:41Z
|
2022-09-05T18:59:22Z
|
https://github.com/WebAssembly/wabt/issues/1978
| 1,359,025,257 | 1,978 |
[
"WebAssembly",
"wabt"
] |
When configuring a git-clone of wabt on a non-tagged commit (like `main`), the following warning is issued:
```
CMake Warning at CMakeLists.txt:46 (message):
fatal: No names found, cannot describe anything.
Error running git describe to determine version
```
This comes from `git describe --tags` failing.
|
Noisy warnings from git describe
|
https://api.github.com/repos/WebAssembly/wabt/issues/1977/comments
| 0 |
2022-09-01T14:46:21Z
|
2022-09-05T18:59:22Z
|
https://github.com/WebAssembly/wabt/issues/1977
| 1,358,969,371 | 1,977 |
[
"WebAssembly",
"wabt"
] |
Hi, this is the first time I'm posting here and also the first time I'm trying to install wabt, so please bare with me if this isn't the right place to place this question. With that said, here it is.
I am trying to install wabt on Kali Linux but cmake is giving me a strange error that I can't get past... It tells me that file wasm2c.top.h doesn't exist:
```
$ cmake --build .
[...]
[ 56%] Generating wasm2c_header_top.cc, wasm2c_header_bottom.cc, wasm2c_source_includes.cc, wasm2c_source_declarations.cc
CMake Error at ~/wabt/scripts/gen-wasm2c-templates.cmake:2 (file):
file failed to open for reading (No such file or directory):
~/wabt/src/template/wasm2c.top.h
gmake[2]: *** [CMakeFiles/cwriter-template.dir/build.make:77: wasm2c_header_top.cc] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:474: CMakeFiles/cwriter-template.dir/all] Error 2
gmake: *** [Makefile:136: all] Error 2
```
But the supposedely missing file does exist:
```
$ cat ~/wabt/src/template/wasm2c.top.h
#include <stdint.h>
#include "wasm-rt.h"
/* TODO(binji): only use stdint.h types in header */
#ifndef WASM_RT_CORE_TYPES_DEFINED
#define WASM_RT_CORE_TYPES_DEFINED
typedef uint8_t u8;
typedef int8_t s8;
typedef uint16_t u16;
typedef int16_t s16;
typedef uint32_t u32;
typedef int32_t s32;
typedef uint64_t u64;
typedef int64_t s64;
typedef float f32;
typedef double f64;
#endif
#ifdef __cplusplus
extern "C" {
#endif
```
Any idea what may be causing this?
|
No such file or directory wasm2c.top.h
|
https://api.github.com/repos/WebAssembly/wabt/issues/1975/comments
| 1 |
2022-08-30T19:25:54Z
|
2022-08-30T19:52:43Z
|
https://github.com/WebAssembly/wabt/issues/1975
| 1,356,204,121 | 1,975 |
[
"WebAssembly",
"wabt"
] |
When running the full test suite on i386, many floating-point-related failures occur. The test summary is reproduced below.
```
**** FAILED ******************************************************************
- test/spec/float_exprs.txt
/ws/build/spectest-interp out/test/spec/float_exprs/float_exprs.json
- test/spec/float_misc.txt
/ws/build/spectest-interp out/test/spec/float_misc/float_misc.json
- test/spec/local_tee.txt
/ws/build/spectest-interp out/test/spec/local_tee/local_tee.json
- test/spec/simd_f32x4_arith.txt
/ws/build/spectest-interp out/test/spec/simd_f32x4_arith/simd_f32x4_arith.json
- test/spec/simd_f32x4_pmin_pmax.txt
/ws/build/spectest-interp out/test/spec/simd_f32x4_pmin_pmax/simd_f32x4_pmin_pmax.json
- test/spec/simd_f64x2_arith.txt
/ws/build/spectest-interp out/test/spec/simd_f64x2_arith/simd_f64x2_arith.json
- test/spec/simd_f64x2_pmin_pmax.txt
/ws/build/spectest-interp out/test/spec/simd_f64x2_pmin_pmax/simd_f64x2_pmin_pmax.json
- test/wasm2c/old-spec/select.txt
/usr/bin/python3 /ws/test/run-spec-wasm2c.py out/test/wasm2c/old-spec/select.txt --bindir=/ws/build --no-error-cmdline -o out/test/wasm2c/old-spec/select
- test/wasm2c/spec/const.txt
TIMEOUT
- test/wasm2c/spec/conversions.txt
/usr/bin/python3 /ws/test/run-spec-wasm2c.py out/test/wasm2c/spec/conversions.wast --bindir=/ws/build --no-error-cmdline -o out/test/wasm2c/spec/conversions
- test/wasm2c/spec/float_exprs.txt
/usr/bin/python3 /ws/test/run-spec-wasm2c.py out/test/wasm2c/spec/float_exprs.wast --bindir=/ws/build --no-error-cmdline -o out/test/wasm2c/spec/float_exprs
- test/wasm2c/spec/float_memory.txt
/usr/bin/python3 /ws/test/run-spec-wasm2c.py out/test/wasm2c/spec/float_memory.wast --bindir=/ws/build --no-error-cmdline -o out/test/wasm2c/spec/float_memory
- test/wasm2c/spec/float_misc.txt
/usr/bin/python3 /ws/test/run-spec-wasm2c.py out/test/wasm2c/spec/float_misc.wast --bindir=/ws/build --no-error-cmdline -o out/test/wasm2c/spec/float_misc
- test/wasm2c/spec/local_tee.txt
/usr/bin/python3 /ws/test/run-spec-wasm2c.py out/test/wasm2c/spec/local_tee.wast --bindir=/ws/build --no-error-cmdline -o out/test/wasm2c/spec/local_tee
```
See the following GHA logs for full details: https://github.com/WebAssembly/wabt/runs/8053046874?check_suite_focus=true
|
Many floating-point errors on i386
|
https://api.github.com/repos/WebAssembly/wabt/issues/1973/comments
| 2 |
2022-08-27T22:29:39Z
|
2023-01-08T22:06:49Z
|
https://github.com/WebAssembly/wabt/issues/1973
| 1,353,189,285 | 1,973 |
[
"WebAssembly",
"wabt"
] |
When running the unittests on an s390x Docker image, the Rot13 test fails.
```
[ RUN ] InterpTest.Rot13
../src/test-interp.cc:546: Failure
Expected equality of these values:
"Uryyb, JroNffrzoyl!"
string_data
Which is: "Hello, WebAssembly!"
[ FAILED ] InterpTest.Rot13 (8 ms)
```
Here is a link to a GitHub Actions workflow that shows this failure: https://github.com/alexreinking/wabt/runs/8052934337?check_suite_focus=true
|
Rot13 test fails on s390x
|
https://api.github.com/repos/WebAssembly/wabt/issues/1972/comments
| 9 |
2022-08-27T21:02:39Z
|
2023-10-27T00:56:27Z
|
https://github.com/WebAssembly/wabt/issues/1972
| 1,353,144,015 | 1,972 |
[
"WebAssembly",
"wabt"
] |
Hi, I'm using the `wast2json` tool to generate the test suites.
In the spec test suites [L190-L192](https://github.com/WebAssembly/spec/blob/main/test/core/memory_init.wast#L190-L192) and [L227-L229](https://github.com/WebAssembly/spec/blob/main/test/core/memory_init.wast#L227-L229), authought they are the `assert_invalid` cases, but the datacount section after generating is lost.
Take the following `wast` (named as `test.wast`) as example:
```
(assert_invalid
(module
(func (export "test")
(data.drop 0)))
"unknown data segment")
```
After the following command:
```
$ ./wast2json test.wast
```
The files are:
```
.
├── test.0.wasm
├── test.json
└── test.wast
```
I found that after the version `1.0.26`, the `test.0.wasm` in binary will be:
```
;; WASM magic and version
00 61 73 6D 01 00 00 00
;; Type section
01 04 01 60 00 00
;; Function section
03 02 01 00
;; Export section
07 08 01 04 74 65 73 74 00 00
;; Lost Data Count section here
;; Code section
0A 07 01 05 00 FC 09 00 0B
```
But the version `1.0.24`, the command:
```
$ ./wast2json --enable-bulk-memory --enable-reference-types test.wast
```
The `test.0.wasm` in binary will be:
```
;; WASM magic and version
00 61 73 6D 01 00 00 00
;; Type section
01 04 01 60 00 00
;; Function section
03 02 01 00
;; Export section
07 08 01 04 74 65 73 74 00 00
;; Data Count section
0C 01 00
;; Code section
0A 07 01 05 00 FC 09 00 0B
```
According to the [spec](https://webassembly.github.io/spec/core/binary/modules.html#data-count-section), the data count section is used to simplify single-pass validation and the `memory.init` and `data.drop` instructions need to use it for checking the data segment index.
Although this case is an invalid module, I think the data count section should be added when converting this WAST with the `wast2json` tool?
Thanks.
|
Lost Data Count Section when encoding from WAT in `wast2json` tool
|
https://api.github.com/repos/WebAssembly/wabt/issues/1959/comments
| 4 |
2022-08-14T01:02:29Z
|
2022-09-01T14:28:40Z
|
https://github.com/WebAssembly/wabt/issues/1959
| 1,338,101,026 | 1,959 |
[
"WebAssembly",
"wabt"
] |
Hi,
I found that when I encode the following WAT into WASM by the `wat2wasm` binary tool in both `1.0.29` or `master`:
(The WAT is in the [test case of the multiple memories proposal](https://github.com/WebAssembly/multi-memory/blob/main/test/core/memory-multi.wast#L47-L84))
```
(module
(memory 1)
(memory $m 1)
(func
(local $v v128)
(drop (v128.load8_lane 1 (i32.const 0) (local.get $v)))
(drop (v128.load8_lane 1 offset=0 1 (i32.const 0) (local.get $v)))
(drop (v128.load8_lane 1 offset=0 align=1 1 (i32.const 0) (local.get $v)))
(drop (v128.load8_lane 1 align=1 1 (i32.const 0) (local.get $v)))
(drop (v128.load8_lane $m 1 (i32.const 0) (local.get $v)))
(drop (v128.load8_lane $m offset=0 1 (i32.const 0) (local.get $v)))
(drop (v128.load8_lane $m offset=0 align=1 1 (i32.const 0) (local.get $v)))
(drop (v128.load8_lane $m align=1 1 (i32.const 0) (local.get $v)))
(drop (v128.load8_lane 1 1 (i32.const 0) (local.get $v)))
(drop (v128.load8_lane 1 offset=0 1 (i32.const 0) (local.get $v)))
(drop (v128.load8_lane 1 offset=0 align=1 1 (i32.const 0) (local.get $v)))
(drop (v128.load8_lane 1 align=1 1 (i32.const 0) (local.get $v)))
(v128.store8_lane 1 (i32.const 0) (local.get $v))
(v128.store8_lane offset=0 1 (i32.const 0) (local.get $v))
(v128.store8_lane offset=0 align=1 1 (i32.const 0) (local.get $v))
(v128.store8_lane align=1 1 (i32.const 0) (local.get $v))
(v128.store8_lane $m 1 (i32.const 0) (local.get $v))
(v128.store8_lane $m offset=0 1 (i32.const 0) (local.get $v))
(v128.store8_lane $m offset=0 align=1 1 (i32.const 0) (local.get $v))
(v128.store8_lane $m align=1 1 (i32.const 0) (local.get $v))
(v128.store8_lane 1 1 (i32.const 0) (local.get $v))
(v128.store8_lane 1 offset=0 1 (i32.const 0) (local.get $v))
(v128.store8_lane 1 offset=0 align=1 1 (i32.const 0) (local.get $v))
(v128.store8_lane 1 align=1 1 (i32.const 0) (local.get $v))
)
)
```
Here, I take the first line of function body `(drop (v128.load8_lane 1 (i32.const 0) (local.get $v)))` as `Line 1`, and so on.
The command is:
```bash
$ ./wat2wasm --output=test.wasm --enable-multi-memory test.wat
```
The output `test.wasm` in binary is as following:
(The tar file here: [test.tar.gz](https://github.com/WebAssembly/wabt/files/9332424/test.tar.gz))
```
;; WASM magic and version
00 61 73 6D 01 00 00 00
;; Type section
01 04 01 60 00 00
;; Function section
03 02 01 00
;; Memory section
05 05 02 00 01 00 01
;; Code section
0A EB 01
;; Vector of code segment
01
;; Code segment: size
E8 01
;; Code segment: local (local $v v128)
01 01 7B
;; Expression start
;; Line 1: (drop (v128.load8_lane 1 (i32.const 0) (local.get $v)))
41 00 20 00 FD 54 00 00 01 1A
;; Line 2: (drop (v128.load8_lane 1 offset=0 1 (i32.const 0) (local.get $v)))
41 00 20 00 FD 54 00 00 01 1A
;; Line 3: (drop (v128.load8_lane 1 offset=0 align=1 1 (i32.const 0) (local.get $v)))
41 00 20 00 FD 54 00 00 01 1A
;; Line 4: (drop (v128.load8_lane 1 align=1 1 (i32.const 0) (local.get $v)))
41 00 20 00 FD 54 00 00 01 1A
;; Line 5: (drop (v128.load8_lane $m 1 (i32.const 0) (local.get $v)))
41 00 20 00 FD 54 00 00 01 1A
;; Line 6: (drop (v128.load8_lane $m offset=0 1 (i32.const 0) (local.get $v)))
41 00 20 00 FD 54 00 00 01 1A
;; Line 7: (drop (v128.load8_lane $m offset=0 align=1 1 (i32.const 0) (local.get $v)))
41 00 20 00 FD 54 00 00 01 1A
;; Line 8: (drop (v128.load8_lane $m align=1 1 (i32.const 0) (local.get $v)))
41 00 20 00 FD 54 00 00 01 1A
;; Line 9: (drop (v128.load8_lane 1 1 (i32.const 0) (local.get $v)))
41 00 20 00 FD 54 00 00 01 1A
;; Line 10: (drop (v128.load8_lane 1 offset=0 1 (i32.const 0) (local.get $v)))
41 00 20 00 FD 54 00 00 01 1A
;; Line 11: (drop (v128.load8_lane 1 offset=0 align=1 1 (i32.const 0) (local.get $v)))
41 00 20 00 FD 54 00 00 01 1A
;; Line 12: (drop (v128.load8_lane 1 align=1 1 (i32.const 0) (local.get $v)))
41 00 20 00 FD 54 00 00 01 1A
;; Line 13: (v128.store8_lane 1 (i32.const 0) (local.get $v))
41 00 20 00 FD 58 00 00 01
;; Line 14: (v128.store8_lane offset=0 1 (i32.const 0) (local.get $v))
41 00 20 00 FD 58 00 00 01
;; Line 15: (v128.store8_lane offset=0 align=1 1 (i32.const 0) (local.get $v))
41 00 20 00 FD 58 00 00 01
;; Line 16: (v128.store8_lane align=1 1 (i32.const 0) (local.get $v))
41 00 20 00 FD 58 00 00 01
;; Line 17: (v128.store8_lane $m 1 (i32.const 0) (local.get $v))
41 00 20 00 FD 58 00 00 01
;; Line 18: (v128.store8_lane $m offset=0 1 (i32.const 0) (local.get $v))
41 00 20 00 FD 58 00 00 01
;; Line 19: (v128.store8_lane $m offset=0 align=1 1 (i32.const 0) (local.get $v))
41 00 20 00 FD 58 00 00 01
;; Line 20: (v128.store8_lane $m align=1 1 (i32.const 0) (local.get $v))
41 00 20 00 FD 58 00 00 01
;; Line 21: (v128.store8_lane 1 1 (i32.const 0) (local.get $v))
41 00 20 00 FD 58 00 00 01
;; Line 22: (v128.store8_lane 1 offset=0 1 (i32.const 0) (local.get $v))
41 00 20 00 FD 58 00 00 01
;; Line 23: (v128.store8_lane 1 offset=0 align=1 1 (i32.const 0) (local.get $v))
41 00 20 00 FD 58 00 00 01
;; Line 24: (v128.store8_lane 1 align=1 1 (i32.const 0) (local.get $v))
41 00 20 00 FD 58 00 00 01
;; Expression end
0B
```
As above, the instructions of `Line 1` to `Line 12` are not totally the same, but the encode result binaries are the same.
The same situation occurs at `Line 13` to `Line 24`.
Take the `Line 7: (drop (v128.load8_lane $m offset=0 align=1 1 (i32.const 0) (local.get $v)))` as example.
The `wat2wasm` encoding is:
```
;; local.get $v
41 00
;; i32.const 0
20 00
;; v128.load8_lane $m offset=0 align=1 1
FD 54 00 00 01
;; drop
1A
```
We can concentrate on the `v128.load8_lane` instruction encoding: `FD 54 00 00 01`.
With the [binary format in multiple memories proposal](https://webassembly.github.io/multi-memory/core/binary/instructions.html#memory-instructions), the memory `$m` will be index `1`, so the `memarg` immdiate of the instruction should not be `00 00`.
I think the encoding should be:
```
;; Instruction v128.load8_lane
FD 54
;; memarg: align (bit 6 of the flags field containing alignment is set)
40
;; memarg: offset
00
;; memarg: memory index
01
;; lane index
01
```
And so on with the other instructions which contains the memory index > 0 with the multiple memory proposal.
Can you help to check if this is en error?
Thanks.
|
Wrong encoding WAT format with the multiple memories proposal
|
https://api.github.com/repos/WebAssembly/wabt/issues/1958/comments
| 4 |
2022-08-14T00:09:41Z
|
2022-08-15T21:39:35Z
|
https://github.com/WebAssembly/wabt/issues/1958
| 1,338,088,244 | 1,958 |
[
"WebAssembly",
"wabt"
] |
0000004: error: bad magic value
|
decompiling error
|
https://api.github.com/repos/WebAssembly/wabt/issues/1956/comments
| 2 |
2022-08-11T23:17:00Z
|
2024-06-26T02:48:27Z
|
https://github.com/WebAssembly/wabt/issues/1956
| 1,336,584,807 | 1,956 |
[
"WebAssembly",
"wabt"
] |
The `wasm2wat` works fine, but `wasm2c` returns:
`000002c: error: invalid section code: 12`
Full output:
wasm2wat:
```
(module
(import "env" "__linear_memory" (memory (;0;) 1))
(data $_ZN5woff210kKnownTagsE (i32.const 0) "pamcdaehaehhxtmhpxameman2/SOtsop tvcmgpffylgacolperp FFCGROVTDBECLBEpsagxmdhnrekHSTLTLCPXMDVaehvxtmvESABFEDGSOPGBUSGCSBEFTSJHTAMTDBCCLBCRLOCLAPC GVSxibstncaravatadbcolbnlsbravccsdftaefxtmfravfravgytshtsujracltromxromdbpoporpkartfpaZfliStalGcolGtaeFlliS"))
```
```
wasm2c -v table_tags.wasm
BeginModule(version: 1)
BeginImportSection(24)
OnImportCount(1)
OnImport(index: 0, kind: memory, module: "env", field: "__linear_memory")
OnImportMemory(import_index: 0, memory_index: 0, initial: 1)
EndImportSection
000002c: error: invalid section code: 12
```
What could be the problem here?
|
000002c: error: invalid section code: 12
|
https://api.github.com/repos/WebAssembly/wabt/issues/1955/comments
| 3 |
2022-08-11T14:44:31Z
|
2022-08-14T23:53:18Z
|
https://github.com/WebAssembly/wabt/issues/1955
| 1,336,067,579 | 1,955 |
[
"WebAssembly",
"wabt"
] |
Hi,
Here I am back again with some stupid question.
The module I'm trying to run dynamically allocates with `malloc` (It's an emscripten WASM binary)
I've worked out sending pointers from the inner runtime to the outside by "transforming" the pointer to `&memory->data[pointer]`, so my runtime can read the value properly from the inner runtime.
But now the runtime calls to a function in my runtime that allocates a string, but I'm unable to "send it back", as in, the runtime can't read the pointer since it's outside of the memory of the runtime (I think, as the pointer turns to a garbage string).
I've tried overwriting `malloc`, to call the runtime's `malloc` as soon as the module is iniitalized:
```
void *malloc (size_t __size) {
// As soon as the runtime is loaded, interop::malloc will contain a pointer to the runtime's malloc.
void* p;
if(interop::malloc != nullptr) {
p = reinterpret_cast<void*>(
interop::malloc(__size)
);
} else {
// When the runtime is loaded, it needs to call malloc so just refer to the builtin_malloc.
p = emscripten_builtin_malloc(__size);
}
return p;
}
```
```
int main() {
puts("Hello world!\n");
puts("Initialising WASM runtime");
wasm_rt_init();
puts("Initialising module");
Z_client_init();
interop::malloc = reinterpret_cast<interop::malloc_t>(Z_clientZ_hc);
interop::free = reinterpret_cast<interop::free_t>(Z_clientZ_ic);
const auto& __wasm_call_ctors = Z_clientZ_fc;
const auto& _main = Z_clientZ_jc;
// Emscripten runtime:
// 1. Pre-run
// 2. Init runtime
// 3. Pre-main
// 4. Call main
// 5. Post-run
// 1. There are no pre-runs in this binary.
// 2. `fc` is added to on init runtime.
puts("Calling ___wasm_call_ctors");
// ___wasm_call_ctors
__wasm_call_ctors();
puts("Alright!");
// 3. There are no pre-mains in this binary.
// 4. `jc` is main in the binary.
u32 result = _main(0, 0);
printf("Main returned: %d\n", result);
}
```
The application loads and runs pretty fine, but as soon as it allocates, the data doesn't make sense to the application and it throws just seemingly random errors (the errors do make sense somewhat tho, because if I go to the call, it always has to do with pointers).
I'm not looking to completely port the emscripten Javascript runtime to C/C++ because I think it's too much work, so I'm just passing known emscripten functions to my emscripten functions. I know what I'm trying to do is hacky at best, but I just want to get the application running so I know I have a shot at this.
**Does anyone have any tips regarding passing pointers from MyApplication(tm) to the wasm runtime?**
The thing that stumps me is that (I think) the wasm-runtime-impl.c should trap, segfault or just quit entirely when it's trying to read out of the WASM memory, but it doesn't crash.
|
[wasm2c] Passing pointer from outside of the runtime to inside the runtime
|
https://api.github.com/repos/WebAssembly/wabt/issues/1953/comments
| 1 |
2022-07-26T11:37:37Z
|
2022-07-26T13:56:10Z
|
https://github.com/WebAssembly/wabt/issues/1953
| 1,318,112,888 | 1,953 |
[
"WebAssembly",
"wabt"
] |
If I make a roundtrip through wabt of an object file, then some objects from WriteBinaryModule() end up with:
```
emnm libskia.SkGeometry.o
/opt/emscripten-llvm/bin/llvm-nm: error: ./libskia.SkGeometry.o: duplicate symbol name sqrtf
```
I'm not really sure whats special about the sqrtf symbol in this object, but some of the other objects also have this issues for other symbols.
I'd be happy to send someone this object file to take a look at?
I had assumed a roundtrip through wabbt should result in the same file, if nothing is modified?
Best
James
|
Roundtrip of object through ReadBinaryIR() -> WriteBinaryModule() result in : emnm : Error duplicate symbol.
|
https://api.github.com/repos/WebAssembly/wabt/issues/1952/comments
| 10 |
2022-07-21T19:34:01Z
|
2022-09-18T05:55:37Z
|
https://github.com/WebAssembly/wabt/issues/1952
| 1,313,711,717 | 1,952 |
[
"WebAssembly",
"wabt"
] |
I've been debugging my transformation, and I've found if I read in a wasm file with ReadBinaryIR() and then just write it back with no modification using WriteBinaryModule(), then I can't link with the new object. E.g. emnm gives and error, out of order section type:0
Interestingly, if I then do:
```
wasm2wat output.o -o output.wat
wat2wasm --relocatable output.wat -o output.o
```
Then the object thats been translated by wasm2wat and back works correctly.
I've tried to look if there are some options I'm missing in the binary reader/writer but I can't see a difference between what wasm2wat does.
Does anyone know what I might be missing?
|
wabbt - ReadBinaryIR() -> WriteBinaryModule() -> emnm output.o :: error: output.o: out of order section type: 0
|
https://api.github.com/repos/WebAssembly/wabt/issues/1951/comments
| 1 |
2022-07-21T14:12:56Z
|
2022-07-21T15:40:39Z
|
https://github.com/WebAssembly/wabt/issues/1951
| 1,313,328,605 | 1,951 |
[
"WebAssembly",
"wabt"
] |
Hi,
Lately I've been reverse engineering some software on the web that uses WebAssembly. I'm pretty familiar with it as I have developed applications with it myself. I found this beautiful program `wasm2c` to aid me in my efforts, but now I'm looking to inject code into the binary. My idea was to use `wasm2c` to decompile the binary, clean it up by hand a bit and maybe add additional functionality.
I've looked into recompiling modules decompiled with `wasm2c` and it seems possible, however compiling this module allows it to be used on desktop (if I understand it correctly).
What would it take to recompile the binary for use in WebAssembly?
Thank you for your time.
|
(wasm2c) Re-compiling to WASM
|
https://api.github.com/repos/WebAssembly/wabt/issues/1950/comments
| 8 |
2022-07-20T15:45:53Z
|
2023-03-07T11:47:33Z
|
https://github.com/WebAssembly/wabt/issues/1950
| 1,311,382,556 | 1,950 |
[
"WebAssembly",
"wabt"
] |
wasm-rt.h is not fully documented on the following points, which is an issue when evaluating wasm2c for embedded targets (or any project that cannot rely on wasm-rt-impl.c):
* What headers generated code and wasm-rt.h are depending on ? E.g. currently wasm-rt.h depends on `#include <setjmp.h>`. While standard, embedded targets such as linux kernel modules do not provide such facilities.
* What will the generated code require from wasm-rt.h exactly ? The [doc](https://github.com/WebAssembly/wabt/blob/main/wasm2c/README.md#symbols-that-must-be-defined-by-the-embedder) lists some of them, but the [actual header](https://github.com/WebAssembly/wabt/blob/main/wasm2c/wasm-rt.h) declares extra functions such as `wasm_rt_set_unwind_target()`
* Backward compatibility promise (or lack of) for all of the above. If tomorrow wasm2c generated code starts depending on new headers/functions, that can break a whole workflow without hope of repair. In the linux kernel module case, anything that would require an arch-specific implementation (e.g setjmp.h) is out of scope for most projects as the maintenance burden would be way to high.
Just to be clear, I'm not saying that wasm2c should promise any of the above if it's not possible to (e.g. future evolutions of wasm/wasm2c capabilities) but having a statement either way would help people evaluating the use of wasm2c for a project.
|
wasm2c's wasm-rt.h documentation
|
https://api.github.com/repos/WebAssembly/wabt/issues/1949/comments
| 5 |
2022-07-20T11:32:56Z
|
2022-08-15T17:50:15Z
|
https://github.com/WebAssembly/wabt/issues/1949
| 1,310,901,617 | 1,949 |
[
"WebAssembly",
"wabt"
] |
Hi,
I would like to add a tool to wabt, that can make some simple modifications to the wasm module loaded.
I've tried to iterate through the module and make some some changes, like renaming the functions..
But when I write the binary again, nothing has changed.
Is it possible to do something like this with wabt, are there some examples?
I'm trying to make some tools for a large project.
Thanks
J
|
How to implement a transformation.
|
https://api.github.com/repos/WebAssembly/wabt/issues/1948/comments
| 1 |
2022-07-18T22:53:02Z
|
2022-07-19T00:04:57Z
|
https://github.com/WebAssembly/wabt/issues/1948
| 1,308,772,170 | 1,948 |
[
"WebAssembly",
"wabt"
] |
I was playing with tables and it _seems_ that `wat2wasm` doesn’t support `elem` sections as they are defined [spec](https://webassembly.github.io/spec/core/text/modules.html#element-segments). However, I might also be reading the spec wrong.
Here are some examples I _think_ should work, but don’t:
```wat
;; `item` is required per spec, but seems unsupported
(module
(table $t 1 funcref)
(func $f (result i32) (i32.const 42))
(elem (table $t) (offset (i32.const 0)) (item $f))
)
;; `elemlist` is technically required to start with a `reftype`,
;; which causes an error
(module
(table $t 1 funcref)
(func $f (result i32) (i32.const 42))
(elem (offset (i32.const 0)) funcref $f)
)
;; Passive elements required a `tableuse`-like parameter to compile,
;; but the spec doesn’t require that.
(module
(type $x (func (result i32)))
(table $t 1 funcref)
(func $f (result i32) (i32.const 42))
;; If you uncomment the `tableuse` parameter `$t`, it works. However, the spec
;; doesn’t require one.
(elem $el (;$t;) $f)
)
;; Declarative shouldn’t need a `tableuse` either.
(module
(type (;0;) (func (result i32)))
(table $t 1 funcref)
(func $f (result i32) (i32.const 42))
(elem declare (;$t;) $f)
)
```
Am I holding it wrong? Or is this a recent change in the spec that wabt 1.0.29 doesn’t reflect yet?
|
Element sections not fully spec compliant?
|
https://api.github.com/repos/WebAssembly/wabt/issues/1946/comments
| 4 |
2022-07-17T22:27:58Z
|
2022-07-18T14:38:57Z
|
https://github.com/WebAssembly/wabt/issues/1946
| 1,307,225,822 | 1,946 |
[
"WebAssembly",
"wabt"
] |
I have a WASM program written in text format that uses the `table.size` instruction.
When using wat2wasm, and then passing that output to wasm2c, I get the following error:
error: unexpected opcode: 0xfc 0x10
I'm using WABT 1.0.29 on macOS.
FYI, I also use `table.grow`.
|
wasm2c: Support `table.size`
|
https://api.github.com/repos/WebAssembly/wabt/issues/1944/comments
| 2 |
2022-07-10T17:46:29Z
|
2022-07-13T18:44:40Z
|
https://github.com/WebAssembly/wabt/issues/1944
| 1,299,977,908 | 1,944 |
[
"WebAssembly",
"wabt"
] |
Hello!
Just getting started with WebAssembly. Downloaded, built, and installed the `wabt` repository on my Windows system.
I created a simple `.wat` file (`test.wat`):
```wat
(module)
```
Then, I ran `wat2wasm` to "parse and typecheck" the file:
```bash
$ wat2wasm test.wat
```
I was surprised to see that it actually compiled my `test.wat` to `test.wasm` as well. The help text from the binary indicates:
> examples:
> \# parse and typecheck test.wat
> $ wat2wasm test.wat
>
> \# parse test.wat and write to binary file test.wasm
> $ wat2wasm test.wat -o test.wasm
>
> \# parse spec-test.wast, and write verbose output to stdout (including
> \# the meaning of every byte)
> $ wat2wasm spec-test.wast -v
Perhaps the help text for running without a `-o` option should indicate that a `.wasm` file will be created with the same filename as the input `.wat` file? Or, if this is actually a bug, should be fixed to only "parse and typecheck" the input file.
|
wat2wasm compiles to .wasm with no options, contrary to documentation
|
https://api.github.com/repos/WebAssembly/wabt/issues/1941/comments
| 4 |
2022-07-07T02:56:18Z
|
2022-07-08T20:40:33Z
|
https://github.com/WebAssembly/wabt/issues/1941
| 1,296,723,883 | 1,941 |
[
"WebAssembly",
"wabt"
] |
### Environment
```
OS : Linux ubuntu 5.13.0-51-generic #58~20.04.1-Ubuntu SMP Tue Jun 14 11:29:12 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
Commit : 57e6a58bfdd0babfd6f7fe401c9f2d8238ec3213
Version : 1.0.29
```
### Proof of concept
[poc.wasm.zip](https://github.com/WebAssembly/wabt/files/8973781/poc.wasm.zip)
### Stack dump
./wasm-decompile --enable-all ./poc.wasm
```
pwndbg> r --enable-all ./poc.wasm
Starting program: ./wasm-decompile --enable-all ./poc.wasm
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7f50234 in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::operator std::basic_string_view<char, std::char_traits<char> >() const () from /lib/x86_64-linux-gnu/libstdc++.so.6
LEGEND: STACK | HEAP | CODE | DATA | RWX | RODATA
─────────────────────────────────────────────────────────────────[ REGISTERS ]──────────────────────────────────────────────────────────────────
RAX 0x4
RBX 0x6323e0 (__libc_csu_init) ◂— endbr64
RCX 0x7fffffffbc98 ◂— 0x4
RDX 0x63b2a7 ◂— 0x6c652000207b2029 /* ') { ' */
RDI 0x0
RSI 0x63b1b1 ◂— 0x7274705f007d20 /* ' }' */
R8 0x63b1b1 ◂— 0x7274705f007d20 /* ' }' */
R9 0x63b1b1 ◂— 0x7274705f007d20 /* ' }' */
R10 0x7fffffffc7a0 —▸ 0x7fffffffc7b0 —▸ 0x7fffffffc700 —▸ 0x7fffffffc720 —▸ 0x7fffffffc750 ◂— ...
R11 0x7fffffffceb8 ◂— 0x0
R12 0x54fef0 (_start) ◂— endbr64
R13 0x7fffffffdec0 ◂— 0x3
R14 0x0
R15 0x0
RBP 0x7fffffffbc80 —▸ 0x7fffffffbcc0 —▸ 0x7fffffffbd10 —▸ 0x7fffffffbd60 —▸ 0x7fffffffbdc0 ◂— ...
RSP 0x7fffffffbc48 —▸ 0x5befc9 ◂— mov qword ptr [rbp - 0x20], rax
RIP 0x7ffff7f50234 ◂— mov rdx, qword ptr [rdi]
───────────────────────────────────────────────────────────────────[ DISASM ]───────────────────────────────────────────────────────────────────
► 0x7ffff7f50234 mov rdx, qword ptr [rdi]
0x7ffff7f50237 mov rax, qword ptr [rdi + 8]
0x7ffff7f5023b ret
0x7ffff7f5023c nop dword ptr [rax]
0x7ffff7f50240 endbr64
0x7ffff7f50244 mov rax, qword ptr [rdi]
0x7ffff7f50247 ret
0x7ffff7f50248 nop dword ptr [rax + rax]
0x7ffff7f50250 endbr64
0x7ffff7f50254 push r12
0x7ffff7f50256 shl rsi, 2
───────────────────────────────────────────────────────────────────[ STACK ]────────────────────────────────────────────────────────────────────
00:0000│ rsp 0x7fffffffbc48 —▸ 0x5befc9 ◂— mov qword ptr [rbp - 0x20], rax
01:0008│ 0x7fffffffbc50 —▸ 0x7fffffffbc80 —▸ 0x7fffffffbcc0 —▸ 0x7fffffffbd10 —▸ 0x7fffffffbd60 ◂— ...
02:0010│ 0x7fffffffbc58 —▸ 0x5514f1 ◂— mov rcx, qword ptr [rbp - 0x18]
03:0018│ 0x7fffffffbc60 —▸ 0x719fb0 —▸ 0x71a000 —▸ 0x71a130 —▸ 0x71a0d0 ◂— ...
04:0020│ 0x7fffffffbc68 —▸ 0x7fffffffbc98 ◂— 0x4
05:0028│ 0x7fffffffbc70 —▸ 0x63b1b1 ◂— 0x7274705f007d20 /* ' }' */
06:0030│ 0x7fffffffbc78 ◂— 0x0
07:0038│ rbp 0x7fffffffbc80 —▸ 0x7fffffffbcc0 —▸ 0x7fffffffbd10 —▸ 0x7fffffffbd60 —▸ 0x7fffffffbdc0 ◂— ...
─────────────────────────────────────────────────────────────────[ BACKTRACE ]──────────────────────────────────────────────────────────────────
► f 0 0x7ffff7f50234
f 1 0x5befc9
f 2 0x5bef9b
f 3 0x5bef47
f 4 0x5bee9b
f 5 0x5ba4e0
f 6 0x5a9325
f 7 0x5a4b56 wabt::Decompiler::Decompile[abi:cxx11]()+3622
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
pwndbg> bt
#0 0x00007ffff7f50234 in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::operator std::basic_string_view<char, std::char_traits<char> >() const () from /lib/x86_64-linux-gnu/libstdc++.so.6
#1 0x00000000005befc9 in unsigned long wabt::cat_compute_size<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, char [3]>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, char const (&) [3]) ()
#2 0x00000000005bef9b in unsigned long wabt::cat_compute_size<char [5], std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, char [3]>(char const (&) [5], std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, char const (&) [3]) ()
#3 0x00000000005bef47 in unsigned long wabt::cat_compute_size<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, char [5], std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, char [3]>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, char const (&) [5], std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, char const (&) [3]) ()
#4 0x00000000005bee9b in unsigned long wabt::cat_compute_size<char [5], std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, char [5], std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, char [3]>(char const (&) [5], std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, char const (&) [5], std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, char const (&) [3]) ()
#5 0x00000000005ba4e0 in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > wabt::cat<char [5], std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, char [5], std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, char [3]>(char const (&) [5], std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, char const (&) [5], std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, char const (&) [3]) ()
#6 0x00000000005a9325 in wabt::Decompiler::DecompileExpr(wabt::Node const&, wabt::Node const*) ()
#7 0x00000000005a4b56 in wabt::Decompiler::Decompile[abi:cxx11]() ()
#8 0x00000000005a33b5 in wabt::Decompile[abi:cxx11](wabt::Module const&, wabt::DecompileOptions const&) ()
#9 0x0000000000550432 in ProgramMain(int, char**) ()
#10 0x0000000000550752 in main ()
#11 0x00007ffff7a92083 in __libc_start_main (main=0x550730 <main>, argc=3, argv=0x7fffffffdec8, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffdeb8) at ../csu/libc-start.c:308
#12 0x000000000054ff1e in _start ()
```
### Credit
P1umer(@P1umer) Q1IQ(@Q1IQ)
|
Segmentation fault in wabt::cat_compute_size
|
https://api.github.com/repos/WebAssembly/wabt/issues/1938/comments
| 1 |
2022-06-24T06:43:25Z
|
2023-03-17T11:32:55Z
|
https://github.com/WebAssembly/wabt/issues/1938
| 1,283,331,255 | 1,938 |
[
"WebAssembly",
"wabt"
] |
The goal is to run the code locally with wasmtime.
wat from WasmFiddle
[native_messaging_host_c_wat.txt](https://github.com/WebAssembly/wabt/files/8945714/native_messaging_host_c_wat.txt)
Errors from wat2wasm demo
```
Error: parseWat failed:
test.wast:11:11: error: unexpected token "anyfunc", expected funcref or externref.
(table 0 anyfunc)
^^^^^^^
test.wast:24:5: error: unexpected token "tee_local", expected an expr.
(tee_local $3
^^^^^^^^^
test.wast:15:30: error: undefined function variable "$sendMessage"
(export "sendMessage" (func $sendMessage))
^^^^^^^^^^^^
test.wast:16:23: error: undefined function variable "$main"
(export "main" (func $main))
```
|
wat2wasm demo throws error for wat from wasdk/WasmFiddle
|
https://api.github.com/repos/WebAssembly/wabt/issues/1937/comments
| 6 |
2022-06-21T04:15:35Z
|
2022-06-21T07:56:02Z
|
https://github.com/WebAssembly/wabt/issues/1937
| 1,277,857,168 | 1,937 |
[
"WebAssembly",
"wabt"
] |
```
PS C:\users\XXXXXX\desktop\wabt-main\build> cmake .. -DCMAKE_BUILD_TYPE=DEBUG -DCMAKE_INSTALL_PREFIX=..\ -G "Visual Studio 17 2022"
-- Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.19044.
-- The C compiler identification is MSVC 19.30.30709.0
-- The CXX compiler identification is MSVC 19.30.30709.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.30.30705/bin/Hostx64/x64/cl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.30.30705/bin/Hostx64/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for alloca.h
-- Looking for alloca.h - not found
-- Looking for unistd.h
-- Looking for unistd.h - not found
-- Looking for snprintf
-- Looking for snprintf - found
-- Looking for strcasecmp
-- Looking for strcasecmp - not found
-- Looking for ENABLE_VIRTUAL_TERMINAL_PROCESSING
-- Looking for ENABLE_VIRTUAL_TERMINAL_PROCESSING - found
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of ssize_t
-- Check size of ssize_t - failed
-- Check size of size_t
-- Check size of size_t - done
-- Found PythonInterp: C:/Users/XXXXXX/AppData/Local/Programs/Python/Python310/python.exe (found suitable version "3.10.2", minimum required is "3.5")
-- Looking for pthread.h
-- Looking for pthread.h - not found
-- Found Threads: TRUE
CMake Error at CMakeLists.txt:567 (message):
Can't find third_party/gtest. Run git submodule update --init, or disable
with CMake -DBUILD_TESTS=OFF.
-- Configuring incomplete, errors occurred!
```
|
Trying to CMake on windows but got Configuring incomplete
|
https://api.github.com/repos/WebAssembly/wabt/issues/1936/comments
| 1 |
2022-06-15T03:26:35Z
|
2022-06-17T14:40:03Z
|
https://github.com/WebAssembly/wabt/issues/1936
| 1,271,618,242 | 1,936 |
[
"WebAssembly",
"wabt"
] |
wasm2c (v1.0.23) throws 0000075: error: invalid section code: 12
Checked spec, and there is such a section:
https://webassembly.github.io/spec/core/binary/modules.html#data-count-section
|
0000075: error: invalid section code: 12
|
https://api.github.com/repos/WebAssembly/wabt/issues/1935/comments
| 1 |
2022-06-14T22:02:50Z
|
2022-06-15T05:05:52Z
|
https://github.com/WebAssembly/wabt/issues/1935
| 1,271,410,993 | 1,935 |
[
"WebAssembly",
"wabt"
] |
I have a WASM program written in text format that uses bulk memory operations.
When using wat2wasm, and then passing that output to wasm2c, I get the following error:
> error: unexpected opcode: 0xfc 0xa
I'm using WABT 1.0.29 on macOS.
|
Bulk memory problem with wat2wasm + wasm2c
|
https://api.github.com/repos/WebAssembly/wabt/issues/1934/comments
| 2 |
2022-06-10T18:44:35Z
|
2022-07-13T18:45:33Z
|
https://github.com/WebAssembly/wabt/issues/1934
| 1,267,891,964 | 1,934 |
[
"WebAssembly",
"wabt"
] |
from the example https://github.com/WebAssembly/wabt/blob/main/wasm2c/README.md, no multi instance example.
I mean create multi vm instance, and load diff module and run at diff memory block.
|
multi instance of wasm2c support
|
https://api.github.com/repos/WebAssembly/wabt/issues/1933/comments
| 6 |
2022-06-02T09:34:23Z
|
2022-06-21T05:50:51Z
|
https://github.com/WebAssembly/wabt/issues/1933
| 1,257,938,064 | 1,933 |
[
"WebAssembly",
"wabt"
] |
Commit: `83a226bcd1816c86fb1fcb0963c6a11e2c373aaf`
## Reproduce
Sample: [interp_sig_index_oob.zip](https://github.com/WebAssembly/wabt/files/8789638/interp_sig_index_oob.zip)
```bash
./wasm-objdump -d interp_sig_index_oob.wasm
./wasm-interp --enable-tail-call interp_sig_index_oob.wasm
```
Output:
```
interp_sig_index_oob.wasm: file format wasm 0x1
Code Disassembly:
000063 func[0] <_start>:
000064: 01 7c | local[0] type=f64
000066: 01 7d | local[1] type=f32
000068: 01 7e | local[2] type=i64
00006a: 01 7f | local[3] type=i32
00006c: 13 13 13 | return_call_indirect 19 19
=================================================================
==4201==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x6060000008b8 at pc 0x559d6f7da883 bp 0x7ffd3d189f90 sp 0x7ffd3d189f80
READ of size 8 at 0x6060000008b8 thread T0
#0 0x559d6f7da882 in std::vector<wabt::Type, std::allocator<wabt::Type> >::size() const /usr/include/c++/9/bits/stl_vector.h:916
#1 0x559d6f823a4a in GetReturnCallDropKeepCount /wabt/src/interp/binary-reader-interp.cc:438
#2 0x559d6f8360be in OnReturnCallIndirectExpr /wabt/src/interp/binary-reader-interp.cc:1146
#3 0x559d6f935ab9 in ReadInstructions /wabt/src/binary-reader.cc:879
#4 0x559d6f92de6d in ReadFunctionBody /wabt/src/binary-reader.cc:609
#5 0x559d6f95d8d3 in ReadCodeSection /wabt/src/binary-reader.cc:2731
#6 0x559d6f960d23 in ReadSections /wabt/src/binary-reader.cc:2885
#7 0x559d6f961b6e in ReadModule /wabt/src/binary-reader.cc:2946
#8 0x559d6f9620fd in wabt::ReadBinary(void const*, unsigned long, wabt::BinaryReaderDelegate*, wabt::ReadBinaryOptions const&) /wabt/src/binary-reader.cc:2964
#9 0x559d6f8424a8 in wabt::interp::ReadBinaryInterp(std::basic_string_view<char, std::char_traits<char> >, void const*, unsigned long, wabt::ReadBinaryOptions const&, std::vector<wabt::Error, std::allocator<wabt::Error> >*, wabt::interp::ModuleDesc*) /wabt/src/interp/binary-reader-interp.cc:1544
#10 0x559d6f7ca861 in ReadModule /wabt/src/tools/wasm-interp.cc:207
#11 0x559d6f7cb0f9 in ReadAndRunModule /wabt/src/tools/wasm-interp.cc:234
#12 0x559d6f7cb6e1 in ProgramMain(int, char**) /wabt/src/tools/wasm-interp.cc:329
#13 0x559d6f7cb793 in main /wabt/src/tools/wasm-interp.cc:335
#14 0x7f56dde380b2 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x270b2)
#15 0x559d6f7c81bd in _start (/wabt/build/wasm-interp+0x1541bd)
Address 0x6060000008b8 is a wild pointer.
SUMMARY: AddressSanitizer: heap-buffer-overflow /usr/include/c++/9/bits/stl_vector.h:916 in std::vector<wabt::Type, std::allocator<wabt::Type> >::size() const
Shadow bytes around the buggy address:
0x0c0c7fff80c0: fa fa fa fa 00 00 00 00 00 00 00 00 fa fa fa fa
0x0c0c7fff80d0: fd fd fd fd fd fd fd fd fa fa fa fa 00 00 00 00
0x0c0c7fff80e0: 00 00 00 00 fa fa fa fa 00 00 00 00 00 00 00 00
0x0c0c7fff80f0: fa fa fa fa 00 00 00 00 00 00 00 fa fa fa fa fa
0x0c0c7fff8100: 00 00 00 00 00 00 00 00 fa fa fa fa fa fa fa fa
=>0x0c0c7fff8110: fa fa fa fa fa fa fa[fa]fa fa fa fa fa fa fa fa
0x0c0c7fff8120: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c0c7fff8130: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c0c7fff8140: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c0c7fff8150: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c0c7fff8160: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
Shadow byte legend (one shadow byte represents 8 application bytes):
Addressable: 00
Partially addressable: 01 02 03 04 05 06 07
Heap left redzone: fa
Freed heap region: fd
Stack left redzone: f1
Stack mid redzone: f2
Stack right redzone: f3
Stack after return: f5
Stack use after scope: f8
Global redzone: f9
Global init order: f6
Poisoned by user: f7
Container overflow: fc
Array cookie: ac
Intra object redzone: bb
ASan internal: fe
Left alloca redzone: ca
Right alloca redzone: cb
Shadow gap: cc
==4201==ABORTING
Aborted
```
## Analysis
The OOB occurs at when `sig_index` is used to [access](https://github.com/WebAssembly/wabt/blob/83a226bcd1816c86fb1fcb0963c6a11e2c373aaf/src/interp/binary-reader-interp.cc#L1142) `module_.func_types` vector.
Variable `sig_index` is [read directly from input](https://github.com/WebAssembly/wabt/blob/83a226bcd1816c86fb1fcb0963c6a11e2c373aaf/src/binary-reader.cc#L868) as [`U32Leb128` form](https://github.com/WebAssembly/wabt/blob/83a226bcd1816c86fb1fcb0963c6a11e2c373aaf/src/binary-reader.cc#L402), so this value can be completely controlled by attacker.
### Possible Fix
Add a check before accessing the vector, just like other handlers, for [example](https://github.com/WebAssembly/wabt/blob/83a226bcd1816c86fb1fcb0963c6a11e2c373aaf/src/interp/binary-reader-interp.cc#L506). It seems that there is a [check](https://github.com/WebAssembly/wabt/blob/83a226bcd1816c86fb1fcb0963c6a11e2c373aaf/src/interp/binary-reader-interp.cc#L1152) for this handler but too late. The comment says "The validator must be run after we get the drop/keep counts, since it changes the type stack.", so maybe we can separate the index check before vector access since checking index does not change any "type stack".
|
Out-of-bound Read at `BinaryReaderInterp::OnReturnCallIndirectExpr`
|
https://api.github.com/repos/WebAssembly/wabt/issues/1929/comments
| 2 |
2022-05-27T20:45:58Z
|
2022-09-17T18:35:32Z
|
https://github.com/WebAssembly/wabt/issues/1929
| 1,251,258,400 | 1,929 |
[
"WebAssembly",
"wabt"
] |
Tried with d8517aa9.
test.wast:
```wast
(module binary
"\00asm" "\01\00\00\00"
"\04\04\01" ;; Table section with 1 entry
"\70\00\00" ;; no max, minimum 0, funcref
"\09\09\01" ;; Element section with 1 entry
"\02" ;; Element with explicit table index
"\80\00" ;; Table index 0, encoded with 2 bytes
"\41\00\0b\00\00" ;; (i32.const 0) with no elements
)
```
(Copied from [spec test suite][1])
Generate Wasm module with wast2json:
```
$ wast2json test.wast
```
Generated Wasm module is different than the input module:
```
$ hd test.0.wasm
00000000 00 61 73 6d 01 00 00 00 04 04 01 70 00 00 09 06 |.asm.......p....|
00000010 01 00 41 00 0b 00 |..A...|
00000016
```
Note that after `0x09` (element section), section size is 6 in the generated Wasm module. In the input the section size is 9. Section contents (element segments) are also different.
[1]: https://github.com/WebAssembly/testsuite/blob/e25ae159357c055b3a6fac99043644e208d26d2a/binary-leb128.wast#L32-L40
|
wast2json changes element section contents in `(module binary ...)`
|
https://api.github.com/repos/WebAssembly/wabt/issues/1927/comments
| 13 |
2022-05-26T13:46:57Z
|
2022-06-06T18:04:31Z
|
https://github.com/WebAssembly/wabt/issues/1927
| 1,249,597,202 | 1,927 |
[
"WebAssembly",
"wabt"
] |
I convert the file into a C file and compile the code using gcc.
`mv webgl.wasm.unity webgl.wasm.gz`
`gunzip webgl.wasm.gz`
`wasm2c webgl.wasm`
`gcc -c webgl.wasm -o webgl`
gcc quits the shell without any prompt.
|
Use wasm2c to convert unityweb into c
|
https://api.github.com/repos/WebAssembly/wabt/issues/1926/comments
| 1 |
2022-05-25T05:51:30Z
|
2022-05-25T07:35:39Z
|
https://github.com/WebAssembly/wabt/issues/1926
| 1,247,521,729 | 1,926 |
[
"WebAssembly",
"wabt"
] |
wasm2c is failing several spec tests if we add `-O` or `-O2` to the compiler command line.
- Example commit here: https://github.com/fixpointOS/wabt/commit/551b3dba69f9d35ddf0271e0e0383e3525d2e50f
- Corresponding CI output on Ubuntu: https://github.com/fixpointOS/wabt/runs/6547538885?check_suite_focus=true
There seem to be at least a few buckets:
1. The WebAssembly spec requires that "There is no observable difference between quiet and signalling NaNs," and the spec tests enforce that some operations transform signalling NaNs into quiet NaNs (e.g. here: https://github.com/WebAssembly/spec/blob/main/test/core/float_exprs.wast#L2361).
But, gcc and clang often make optimizations that preserve signalling NaNs, even when the same code, compiled without optimization, will turn a signalling NaN into a quiet NaN. E.g. in this code which is essentially what wasm2c generates for a promote/demote:
```c
float func(float x)
{
double y = x;
return y;
}
```
On x86-64 and compiling without optimization, gcc and clang will turn this into a cvtss2sd/cvtsd2ss, which turns a signalling NaN into a quiet NaN (passing the tests). If we compiled with `-O`, the function turns into a NOP and the signalling NaN is preserved (breaking the tests). I couldn't find a way to change this behavior with fenv(3) or with a `-fno-...` optimization flag. One possible solution might be to mark all floating-point stack variables as `volatile`, but this may be a heavy price in terms of slowdown. Maybe there's a path forward that involves explicitly clearing a signalling NaN only when (a) storing into linear memory, (b) reinterpreting as integer, or (c) returning to a host function? It might be hard to guarantee this catches all the edge cases...
2. The spec requires OOB loads/stores to trap deterministically, but when using mprotect & a signal handler to detect OOB memory access, gcc/clang `-O` omits loads/stores if they don't affect the output or a visible side-effect (which the segfault doesn't count as). E.g. even this test fails: https://github.com/WebAssembly/wabt/blob/main/test/wasm2c/address-overflow.txt
I'm curious how this is done in other Wasm engines that also use the "signal handler trick" to detect OOB memory access (while, hopefully, also optimizing to remove dead code while still passing all the spec tests)?
3. The spec tests say, "Implementations are required to have every call consume some abstract resource towards exhausting some abstract finite limit, such that infinitely recursive test cases reliably trap in finite time," and enforce this, e.g. here: https://github.com/WebAssembly/spec/blob/master/test/core/call.wast#L337 But, I think gcc/clang `-O` are optimizing these kinds of runaway recursive functions into infinite iteration/proper tail recursion, so the exhaustion segfault never arrives. (I fear this issue was recently introduced by #1875.)
---
For our purposes, we'd like to compile wasm2c output with optimization, and we also want the "almost-deterministic"/spec-conforming behavior of WebAssembly, so it seems worthwhile to get the tests passing even with `-O`. I'd love to hear if this has been discussed before and what others think about the best route (@binji @sbc100 @kripken ?).
|
Several spec tests fail if wasm2c output compiled with `-O` or `-O2`
|
https://api.github.com/repos/WebAssembly/wabt/issues/1925/comments
| 5 |
2022-05-23T21:59:01Z
|
2022-07-12T00:12:50Z
|
https://github.com/WebAssembly/wabt/issues/1925
| 1,245,740,051 | 1,925 |
[
"WebAssembly",
"wabt"
] |
Commit: `d8517aa922ddd3ffd6d7f28f00d2bb0f9853cf88`
## Reproduce
Fuzzed Sample: [wabt_decomp_is_name_assert.zip](https://github.com/WebAssembly/wabt/files/8750089/wabt_decomp_is_name_assert.zip)
Simplified Sample:
```
$ cat simplified.wat
(module
(type (;0;) (func (result i64)))
(func (;0;) (type 0) (result i64)
global.get 0)
(global (;0;) i64 (i64.const 8))
(export "" (global 0))
)
$ ./wat2wasm ./simplified.wat && ./wasm-decompile ./simplified.wasm
wasm-decompile: /wabt/src/ir.h:61: const string& wabt::Var::name() const: Assertion `is_name()' failed.
Aborted (core dumped)
```
## Analysis
`struct Var` has a `union` field, and it has a `type_` field to indicate which union entry should be accessed.
```c++
// Definition of VarType
enum class VarType {
Index,
Name,
};
// Private fields of `struct Var`
VarType type_;
union {
Index index_;
std::string name_;
};
```
If `type_` is `Index`, `index_` should be accessed; if `type_` is `Name`, `name_` should be accessed. Current assertion error is caused by we are accessing `name_` of a `struct Var` whose `type_` is `Index`, and in release build in which `assert` is removed, the type confusion can occur (e.i. an unsigned integer will be used as a pointer).
### Root Cause
Here is the intended behavior first:
1. `ReadBinaryIr` is called in `ProgramMain` of `wasm-decompile` to parse the binary, in which `Var var` field of `GlobalGetExpr` is [initialized to](https://github.com/WebAssembly/wabt/blob/d8517aa922ddd3ffd6d7f28f00d2bb0f9853cf88/src/binary-reader-ir.cc#L924) `type_ == Index` first.
2. Then `ApplyNames` in `ProgramMain` is called to [convert](https://github.com/WebAssembly/wabt/blob/d8517aa922ddd3ffd6d7f28f00d2bb0f9853cf88/src/apply-names.cc#L426) `var` field of every `GlobalGetExpr` to `type_ == Name` version.
3. Therefore [when decompiling this expression](https://github.com/WebAssembly/wabt/blob/d8517aa922ddd3ffd6d7f28f00d2bb0f9853cf88/src/decompiler.cc#L446) at `Decompiler::DecompileExpr`, the [assertion](https://github.com/WebAssembly/wabt/blob/d8517aa922ddd3ffd6d7f28f00d2bb0f9853cf88/src/decompiler.cc#L225) must hold.
However, the problem occurs when name of global [is empty](https://github.com/WebAssembly/wabt/blob/d8517aa922ddd3ffd6d7f28f00d2bb0f9853cf88/src/apply-names.cc#L143) (e.i. `== ""`). In such case, `type_` field will not be converted into `Name` version and will still be `Index`, which causes the assertion error.
Here is the reason why name of global becomes empty, which makes sense intuitively because export name is given as empty string at `(export "" (global 0))`:
1. When `NameGenerator::VisitExport` is called inside `GenerateNames`, `MaybeUseAndBindName` will [be called](https://github.com/WebAssembly/wabt/blob/d8517aa922ddd3ffd6d7f28f00d2bb0f9853cf88/src/generate-names.cc#L382) with `export_->name.c_str()` as an empty C string. Therefore the global name is assigned to `"$"`.
2. Then `RenameToIdentifier` called inside `RenameAll` would [rename `"$"` into `""`](https://github.com/WebAssembly/wabt/blob/d8517aa922ddd3ffd6d7f28f00d2bb0f9853cf88/src/decompiler-naming.h#L56), which makes the global name become an empty string.
### Possible Fix
I think the best location to fix this bug is at `RenameToIdentifier`, because even if `export_->name.c_str()` is not empty but something like `" $_?"`, the bug can still be triggered. The reason is that `RenameToIdentifier` always skips leading non-alphanumeric character and generates empty string when there is no alphanumeric character. Therefore this situation should be tackled.
|
Assertion `is_name()` failed at wasm-decompiler caused by empty global name
|
https://api.github.com/repos/WebAssembly/wabt/issues/1924/comments
| 3 |
2022-05-22T19:08:09Z
|
2022-09-17T18:35:32Z
|
https://github.com/WebAssembly/wabt/issues/1924
| 1,244,340,785 | 1,924 |
[
"WebAssembly",
"wabt"
] |
Commit: `d8517aa922ddd3ffd6d7f28f00d2bb0f9853cf88`
## Reproduce
Fuzzed Sample: [decomp_heap_of.zip](https://github.com/WebAssembly/wabt/files/8748689/decomp_heap_of.zip)
Simplified Sample:
```
$ cat simplified.wat
(module
(type (;0;) (func (param i32 i64 i64 f32) (result i32 i64 i64 f64)))
(func (type 0) (param i32 i64 i64 f32) (result i32 i64 i64 f64)
unreachable
block (param i32 i64 i64 f32) (result i32 i64 i64 f64)
unreachable
end))
$ ./wat2wasm simplified.wat && ./wasm-decompile simplified.wasm
=================================================================
==32616==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x6080000005e0 at pc 0x5647b06e8df5 bp 0x7ffc5b2ad740 sp 0x7ffc5b2ad730
READ of size 4 at 0x6080000005e0 thread T0
#0 0x5647b06e8df4 in wabt::Node::operator=(wabt::Node&&) (/wabt/asan/wasm-decompile+0x283df4)
#1 0x5647b06e8dad in wabt::Node::Node(wabt::Node&&) (/wabt/asan/wasm-decompile+0x283dad)
#2 0x5647b0729688 in std::enable_if<std::__and_<std::__not_<std::__is_tuple_like<wabt::Node> >, std::is_move_constructible<wabt::Node>, std::is_move_assignable<wabt::Node> >::value, void>::type std::swap<wabt::Node>(wabt::Node&, wabt::Node&) (/wabt/asan/wasm-decompile+0x2c4688)
#3 0x5647b071f1ac in void std::iter_swap<__gnu_cxx::__normal_iterator<wabt::Node*, std::vector<wabt::Node, std::allocator<wabt::Node> > >, __gnu_cxx::__normal_iterator<wabt::Node*, std::vector<wabt::Node, std::allocator<wabt::Node> > > >(__gnu_cxx::__normal_iterator<wabt::Node*, std::vector<wabt::Node, std::allocator<wabt::Node> > >, __gnu_cxx::__normal_iterator<wabt::Node*, std::vector<wabt::Node, std::allocator<wabt::Node> > >) (/wabt/asan/wasm-decompile+0x2ba1ac)
#4 0x5647b07123fc in __gnu_cxx::__normal_iterator<wabt::Node*, std::vector<wabt::Node, std::allocator<wabt::Node> > > std::_V2::__rotate<__gnu_cxx::__normal_iterator<wabt::Node*, std::vector<wabt::Node, std::allocator<wabt::Node> > > >(__gnu_cxx::__normal_iterator<wabt::Node*, std::vector<wabt::Node, std::allocator<wabt::Node> > >, __gnu_cxx::__normal_iterator<wabt::Node*, std::vector<wabt::Node, std::allocator<wabt::Node> > >, __gnu_cxx::__normal_iterator<wabt::Node*, std::vector<wabt::Node, std::allocator<wabt::Node> > >, std::random_access_iterator_tag) (/wabt/asan/wasm-decompile+0x2ad3fc)
#5 0x5647b0703f69 in __gnu_cxx::__normal_iterator<wabt::Node*, std::vector<wabt::Node, std::allocator<wabt::Node> > > std::_V2::rotate<__gnu_cxx::__normal_iterator<wabt::Node*, std::vector<wabt::Node, std::allocator<wabt::Node> > > >(__gnu_cxx::__normal_iterator<wabt::Node*, std::vector<wabt::Node, std::allocator<wabt::Node> > >, __gnu_cxx::__normal_iterator<wabt::Node*, std::vector<wabt::Node, std::allocator<wabt::Node> > >, __gnu_cxx::__normal_iterator<wabt::Node*, std::vector<wabt::Node, std::allocator<wabt::Node> > >) (/wabt/asan/wasm-decompile+0x29ef69)
#6 0x5647b06ea857 in wabt::AST::Construct(wabt::intrusive_list<wabt::Expr> const&, unsigned int, unsigned int, bool)::{lambda(unsigned long)#2}::operator()(unsigned long) const (/wabt/asan/wasm-decompile+0x285857)
#7 0x5647b06eb780 in wabt::AST::Construct(wabt::intrusive_list<wabt::Expr> const&, unsigned int, unsigned int, bool) (/wabt/asan/wasm-decompile+0x286780)
#8 0x5647b06ff25d in wabt::Decompiler::Decompile[abi:cxx11]() /wabt/src/decompiler.cc:795
#9 0x5647b06e6685 in wabt::Decompile[abi:cxx11](wabt::Module const&, wabt::DecompileOptions const&) /wabt/src/decompiler.cc:854
#10 0x5647b0634523 in ProgramMain(int, char**) /wabt/src/tools/wasm-decompile.cc:103
#11 0x5647b0634881 in main /wabt/src/tools/wasm-decompile.cc:116
#12 0x7fbc7151b0b2 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x270b2)
#13 0x5647b06331bd in _start (/wabt/asan/wasm-decompile+0x1ce1bd)
Address 0x6080000005e0 is a wild pointer.
SUMMARY: AddressSanitizer: heap-buffer-overflow (/wabt/asan/wasm-decompile+0x283df4) in wabt::Node::operator=(wabt::Node&&)
Shadow bytes around the buggy address:
0x0c107fff8060: fa fa fa fa 00 00 00 00 00 00 00 00 00 00 00 fa
0x0c107fff8070: fa fa fa fa 00 00 00 00 00 00 00 00 00 00 00 fa
0x0c107fff8080: fa fa fa fa 00 00 00 00 00 00 00 00 00 00 00 fa
0x0c107fff8090: fa fa fa fa fd fd fd fd fd fd fd fd fd fd fd fa
0x0c107fff80a0: fa fa fa fa 00 00 00 00 00 00 00 00 00 00 00 00
=>0x0c107fff80b0: fa fa fa fa fa fa fa fa fa fa fa fa[fa]fa fa fa
0x0c107fff80c0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c107fff80d0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c107fff80e0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c107fff80f0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c107fff8100: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
Shadow byte legend (one shadow byte represents 8 application bytes):
Addressable: 00
Partially addressable: 01 02 03 04 05 06 07
Heap left redzone: fa
Freed heap region: fd
Stack left redzone: f1
Stack mid redzone: f2
Stack right redzone: f3
Stack after return: f5
Stack use after scope: f8
Global redzone: f9
Global init order: f6
Poisoned by user: f7
Container overflow: fc
Array cookie: ac
Intra object redzone: bb
ASan internal: fe
Left alloca redzone: ca
Right alloca redzone: cb
Shadow gap: cc
==32616==ABORTING
Aborted
```
## Analysis
The corruption occurs at [`std::rotate`](https://github.com/WebAssembly/wabt/blob/d8517aa922ddd3ffd6d7f28f00d2bb0f9853cf88/src/decompiler-ast.h#L279), at which variable `num_vars`, which is supposed to be a positive number, is `-3`. Therefore the first argument, `exp_stack.end() - num_vars - amount`, becomes `exp_stack.end() + 2` (`amount` is `1`), which is an invalid iterator.
### Root Cause
When [`Construct`](https://github.com/WebAssembly/wabt/blob/d8517aa922ddd3ffd6d7f28f00d2bb0f9853cf88/src/decompiler-ast.h#L236) is called on body of the `block` expression, `value_stack_depth_start` will be [assigned](https://github.com/WebAssembly/wabt/blob/d8517aa922ddd3ffd6d7f28f00d2bb0f9853cf88/src/decompiler-ast.h#L244) to `1 - 4 = -3`. The reason is that there are 4 parameters in this expression, but there is only 1 expression in `exp_stack`, so the start index will be subtracted to a negative number. Then before `Construct` returns, `value_stack_depth` is [assigned](https://github.com/WebAssembly/wabt/blob/d8517aa922ddd3ffd6d7f28f00d2bb0f9853cf88/src/decompiler-ast.h#L345) to `value_stack_depth_start`, which is `-3`. Then after `Construct` to process body of `block` is returned, `Construct` to process body of `func` continues, and it [assigns](https://github.com/WebAssembly/wabt/blob/d8517aa922ddd3ffd6d7f28f00d2bb0f9853cf88/src/decompiler-ast.h#L270) `num_vars` to `value_stack_in_variables - value_stack_depth_start`, which makes it become `-3` and causes the following crash.
### Possible Fix
However, if we change the first `unreachable` to something like `local.get 0`, the type checker will fail with message `error: type mismatch in block, expected [i32, i64, i64, f32] but got [i32]`. This suggests that the problem should be fixed at [type checker](https://github.com/WebAssembly/wabt/blob/d8517aa922ddd3ffd6d7f28f00d2bb0f9853cf88/src/type-checker.cc#L959) or [validation](https://github.com/WebAssembly/wabt/blob/d8517aa922ddd3ffd6d7f28f00d2bb0f9853cf88/src/shared-validator.cc#L1173) to consider `unreachable` expression and return an error at such situation, instead of adding anything at the AST parser.
|
Memory corruption at wasm-decompile caused by unmatched parameters
|
https://api.github.com/repos/WebAssembly/wabt/issues/1923/comments
| 1 |
2022-05-22T03:14:08Z
|
2022-05-22T03:54:00Z
|
https://github.com/WebAssembly/wabt/issues/1923
| 1,244,134,438 | 1,923 |
[
"WebAssembly",
"wabt"
] |
Commit: `d8517aa922ddd3ffd6d7f28f00d2bb0f9853cf88`
## Reproduce
Fuzzed Sample:
[decomp_size_ge_nargs.zip](https://github.com/WebAssembly/wabt/files/8748269/decomp_size_ge_nargs.zip)
Simplified Sample:
```bash
$ cat simplified.wat
(module
(type (;0;) (func (param i32 i32) (result i32)))
(func (;0;) (type 0) (param i32 i32) (result i32)
local.get 0
loop (param i32) (result i32) ;; label = @1
unreachable
br_table 0 (;@1;) 0 (;@1;)
i32.add
end))
$ ./wat2wasm simplified.wat && ./wasm-decompile simplified.wasm
wasm-decompile: wabt/src/decompiler-ast.h:98: wabt::Node& wabt::AST::InsertNode(wabt::NodeType, wabt::ExprType, const wabt::Expr*, wabt::Index): Assertion `exp_stack.size() >= nargs' failed.
Aborted
```
## Analysis
In debug mode, assertion failure is triggered; in release mode, since there is no such assertion, `std::move` after such length check can cause an OOB read.
```c++
std::move(exp_stack.end() - nargs, exp_stack.end(),
std::back_inserter(n.children));
// Since size of `exp_stack` is less than `nargs`,
// `exp_stack.end() - nargs` points to a negative index
```
### Root Cause
The problem is mainly caused by lack of handler for `ExprType::BrTable` at [`Construct` function](https://github.com/WebAssembly/wabt/blob/d8517aa922ddd3ffd6d7f28f00d2bb0f9853cf88/src/decompiler-ast.h#L165). For branch instruction like `Br`, `BrIf` and `BrTable`, the function `GetExprArity` [called](https://github.com/WebAssembly/wabt/blob/d8517aa922ddd3ffd6d7f28f00d2bb0f9853cf88/src/decompiler-ast.h#L166) at `Construct` [returns](https://github.com/WebAssembly/wabt/blob/d8517aa922ddd3ffd6d7f28f00d2bb0f9853cf88/src/ir-util.cc#L123) `GetLabelArity` instead of number of arguments to be consumed on stack. Therefore, for branch expression, [special case is handled](https://github.com/WebAssembly/wabt/blob/d8517aa922ddd3ffd6d7f28f00d2bb0f9853cf88/src/decompiler-ast.h#L219), where `nargs` argument of `InsertNode` is specified as correct constant. However, `BrTable` is not handled like other branch expressions so [default branch](https://github.com/WebAssembly/wabt/blob/d8517aa922ddd3ffd6d7f28f00d2bb0f9853cf88/src/decompiler-ast.h#L230) is executed, which uses `arity.nargs` as `nargs` argument, but this is incorrect for `BrTable` because it should be just constant `1`. This can consume more expressions in `exp_stack` than expected (e.i. `2` in this sample), which causes the next expression to not have enough expressions to consume in `exp_stack`.
### Possible Fix
Add `case` statement for `BrTable` in `Construct`.
```c++
case ExprType::BrTable: {
InsertNode(NodeType::Expr, ExprType::BrTable, &e, 1).u.lt =
mc.GetLabel(cast<BrTableExpr>(&e)->default_target)->label_type;
return;
}
```
|
OOB Read at wasm-decompile caused by lack of BrTable handling
|
https://api.github.com/repos/WebAssembly/wabt/issues/1922/comments
| 0 |
2022-05-21T19:52:13Z
|
2022-09-17T18:35:31Z
|
https://github.com/WebAssembly/wabt/issues/1922
| 1,244,068,730 | 1,922 |
[
"WebAssembly",
"wabt"
] | null |
any way to link multi wat file to one module?
|
https://api.github.com/repos/WebAssembly/wabt/issues/1921/comments
| 1 |
2022-05-17T09:26:10Z
|
2022-05-17T20:44:30Z
|
https://github.com/WebAssembly/wabt/issues/1921
| 1,238,347,331 | 1,921 |
[
"WebAssembly",
"wabt"
] |
Commit: `d8517aa922ddd3ffd6d7f28f00d2bb0f9853cf88`
Reproduce:
```bash
./wasm2wat_fuzzer < ./wabt_intrusive_list_back.wasm
```
Stack Trace:
```
#4 0x00000000004c3963 in wabt::intrusive_list<wabt::Expr>::back() ()
#5 0x00000000004c2cfa in wabt::(anonymous namespace)::BinaryReaderIR::TopLabelExpr(wabt::(anonymous namespace)::LabelNode**, wabt::Expr**) ()
#6 0x0000000000428891 in wabt::(anonymous namespace)::BinaryReaderIR::OnEndExpr() ()
#7 0x00000000005495e9 in wabt::(anonymous namespace)::BinaryReader::ReadInstructions(bool, unsigned long, wabt::Opcode*)
()
#8 0x0000000000541fde in wabt::(anonymous namespace)::BinaryReader::ReadInitExpr(unsigned int) ()
#9 0x000000000053929f in wabt::(anonymous namespace)::BinaryReader::ReadElemSection(unsigned long) ()
#10 0x0000000000528f1d in wabt::(anonymous namespace)::BinaryReader::ReadSections(wabt::(anonymous namespace)::BinaryReader::ReadSectionsOptions const&) ()
#11 0x00000000005247b9 in wabt::(anonymous namespace)::BinaryReader::ReadModule(wabt::(anonymous namespace)::BinaryReader::ReadModuleOptions const&) ()
#12 0x0000000000523ac1 in wabt::ReadBinary(void const*, unsigned long, wabt::BinaryReaderDelegate*, wabt::ReadBinaryOptions const&) ()
#13 0x000000000050e9fe in wabt::ReadBinaryIr(char const*, void const*, unsigned long, wabt::ReadBinaryOptions const&, std::__1::vector<wabt::Error, std::__1::allocator<wabt::Error> >*, wabt::Module*) ()
#14 0x000000000040380c in LLVMFuzzerTestOneInput ()
#15 0x00000000004128de in main ()
```
[poc.zip](https://github.com/WebAssembly/wabt/files/8702151/poc.zip)
It seems that a function is accessing an empty list, so that assertion error occurs.
|
Assertion `!empty()` failed at `wabt::intrusive_list<wabt::Expr>::back()` of `intrusive-list.h:402`
|
https://api.github.com/repos/WebAssembly/wabt/issues/1920/comments
| 0 |
2022-05-16T17:33:19Z
|
2022-05-18T01:38:09Z
|
https://github.com/WebAssembly/wabt/issues/1920
| 1,237,478,158 | 1,920 |
[
"WebAssembly",
"wabt"
] |
It looks like `wamrc` currently supports generating LLVM optimized and unoptimzed code. I am looking to run some instrumentation passes on this LL file and generate an AoT executable again.
However, function labels seem to be discarded in the generated LL file (particularly the `main` or `start` function), and it cannot be re-compiled using `clang`. Is there a way to generate Wasm/AoT code from the generated LL file?
Thanks!
|
wamrc: Compiling generated LL files
|
https://api.github.com/repos/WebAssembly/wabt/issues/1916/comments
| 2 |
2022-05-03T19:43:28Z
|
2022-05-03T22:56:06Z
|
https://github.com/WebAssembly/wabt/issues/1916
| 1,224,535,960 | 1,916 |
[
"WebAssembly",
"wabt"
] |
In the process of re-compiling the output of `wasm2c`, the `wasm-rt-impl.c` file requires `setjmp.h`, which cannot be found by the wasi-sdk clang release.
How do you get around this? Thanks!
|
wasm2c compilation error: 'setjmp.h' cannot be found
|
https://api.github.com/repos/WebAssembly/wabt/issues/1914/comments
| 8 |
2022-05-03T14:56:25Z
|
2022-05-18T01:49:13Z
|
https://github.com/WebAssembly/wabt/issues/1914
| 1,224,214,725 | 1,914 |
[
"WebAssembly",
"wabt"
] | null |
F
|
https://api.github.com/repos/WebAssembly/wabt/issues/1913/comments
| 0 |
2022-05-02T01:28:30Z
|
2022-05-02T03:15:15Z
|
https://github.com/WebAssembly/wabt/issues/1913
| 1,222,378,738 | 1,913 |
[
"WebAssembly",
"wabt"
] |
(Spinning this off from https://github.com/WebAssembly/wabt/pull/1814#discussion_r850917266)
Here is a proposal for how to improve safety when linking multiple modules together with wasm2c.
As background:
- At present, for every import **or** export, wasm2c writes an extern declaration in the generated header file. The declaration is in the form of a global pointer, named with the module name and import/export name. The exporting module's `.c` file defines the actual pointer, as well as the actual (static) element itself. At runtime, the generated `init_exports()` function initializes each pointers to point to the exported element.
- If #1814 is merged, the behavior remains essentially the same. (The difference is that exports are now represented by functions that take a module instance pointer, instead of with global pointers, but the naming and linking is basically the same.)
The concern in both cases is that, because both imports **and** exports produce a declaration in the generated `.h` file, and each module's `.c` file only includes its own `.h` file, the compiler won't see an incompatibility between the types of an export vs. import. (It became easier for this to happen after removing signature mangling from function and global imports/exports, but I think this was and still is an issue for memories and tables too.) The C linker will happily link the `.o` files together as long as the symbol can be resolved.
So it's pretty easy to get in a situation where compiling two wasm2c-generated modules each succeeds independently, and then linking the resulting `.o` files succeeds, but the user gets invalid behavior at runtime. This seems to violate the Wasm soundness guarantees.
#### Here's a straw-man proposal that would try to catch these at compile-time instead:
1. wasm2c stops making declarations for _imports_ in the generated `.h` file. Declarations would be made by the exporting module only. For an import, the module's generated `.h` file would `#include` the `.h` file of every module it imports from. The `wasm2c` command-line interface would require the user to specify the `.h` filename for each imported-from module. (I'm a little scared of having a default here because it seems dangerous to write a `#include` based on a modname that comes from the import component of a possibly adversarial wasm input.)
2. For the importing module, `wasm2c` generates a bunch of C11 `_Static_assert` statements to enforce the Import Subtyping validation rules (https://webassembly.github.io/spec/core/valid/types.html#import-subtyping). Usually these are just about type equality, but for memories and tables it has to compare the min and max sizes. This would mean that compiling a wasm2c-generated module would require a C11 compiler (or there could be a command-line flag to disable them...).
If there is consensus to go in this direction, it would also be nice to prettify the naming of imports and exports. Maybe instead of `Z_modnameZ_name`, it could be something like `w2c_modname_name` or `wasm_modname_name`. (A distinguished prefix seems necessary to avoid letting modules import a system symbol automatically.)
|
wasm2c linking safety (enforcing import subtyping rules at compile time)
|
https://api.github.com/repos/WebAssembly/wabt/issues/1908/comments
| 9 |
2022-04-26T09:03:12Z
|
2022-07-04T06:24:27Z
|
https://github.com/WebAssembly/wabt/issues/1908
| 1,215,636,966 | 1,908 |
[
"WebAssembly",
"wabt"
] |
Tried https://webassembly.github.io/wabt/demo/wat2wasm/ feeding in some simple Wat with exception definitions:

I do not get the errors if I run the tool manually.
|
Make online wat2wasm respect the enable exception flag
|
https://api.github.com/repos/WebAssembly/wabt/issues/1906/comments
| 8 |
2022-04-25T06:32:44Z
|
2022-12-23T04:53:16Z
|
https://github.com/WebAssembly/wabt/issues/1906
| 1,214,037,831 | 1,906 |
[
"WebAssembly",
"wabt"
] |
Since this is a repo in the org for the W3C core recommendation, I think it is a fair ask to have a flag that constrains features to what's included in that, and no more. It will help with tracking https://github.com/WebAssembly/wabt#supported-proposals and make upgrades seamless.
I'm not asking for this to be by default turned on, rather to make it possible to achieve undoing all the flags that turn on things not in the recommended spec. Ex. `--enable-1.0` (please don't call whatever flag MVP as that's jargon and not a W3C version number).
Ex. just like `enable-all`
```
--enable-1.0 Enable only features in version 1.0 of the core WebAssembly standard
```
|
Add a flag that constrains features to the W3C recommendation
|
https://api.github.com/repos/WebAssembly/wabt/issues/1899/comments
| 7 |
2022-04-14T00:02:48Z
|
2022-04-14T00:36:09Z
|
https://github.com/WebAssembly/wabt/issues/1899
| 1,203,896,313 | 1,899 |
[
"WebAssembly",
"wabt"
] |
When function indices are used in `ref.func`, there is a check to make sure the index is declared in the element section before the code section.
However, this check is too strong in wabt as uses in the global section should be ok. Example:
```
;; the reference in the global is ok
(module (func $f1) (global funcref (ref.func $f1)))
```
It fails to validate in wabt (validates in the reference interpreter though):
```
func.wat:1:46: error: function 0 is not declared in any elem sections
(module (func $f1) (global funcref (ref.func $f1)))
```
|
[reference types]: `ref.func` declaration check is overly strict
|
https://api.github.com/repos/WebAssembly/wabt/issues/1893/comments
| 1 |
2022-04-12T20:43:59Z
|
2022-04-13T20:07:30Z
|
https://github.com/WebAssembly/wabt/issues/1893
| 1,202,368,716 | 1,893 |
[
"WebAssembly",
"wabt"
] |
It would be great to be able to copy-paste the binary .wasm output as base64 rather than having to download it.
Thank you!
|
RFE: Make online wat2wasm demo output base64
|
https://api.github.com/repos/WebAssembly/wabt/issues/1891/comments
| 4 |
2022-04-07T16:20:24Z
|
2022-04-26T18:15:59Z
|
https://github.com/WebAssembly/wabt/issues/1891
| 1,196,285,223 | 1,891 |
[
"WebAssembly",
"wabt"
] |
An example program like the following should fail during validation:
```
;;; TOOL: wat2wasm
;;; ARGS: --enable-function-references
;;; ERROR: 1
(module
(func (param $f (ref $x)) (result f32))
)
(;; STDERR ;;;
;;; STDERR ;;)
```
Because the `ref $x` is unbound.
Right now this will trigger an assertion failure:
```
+wat2wasm: ../../../src/wast-parser.cc:283: void wabt::(anonymous namespace)::ResolveTypeName(const wabt::Module &, wabt::Type &, wabt::Index, const std::unordered_map<uint32_t, std::string> &): Assertion `type_index != kInvalidIndex' failed.
```
which is erroring too soon. Instead, the representation of parsed types should probably include a `Var` so that the name lookup can be done in validation, when the entire module state is built up already.
|
Typed funcref: handle unbound type names in validation
|
https://api.github.com/repos/WebAssembly/wabt/issues/1890/comments
| 2 |
2022-04-05T02:05:16Z
|
2022-04-11T09:35:16Z
|
https://github.com/WebAssembly/wabt/issues/1890
| 1,192,511,737 | 1,890 |
[
"WebAssembly",
"wabt"
] |
When building wabt-1.0.28 with gcc-12.0.1 (Fedora 36 Beta), I'm getting these new testsuite failures:
```
...
- test/wasm2c/spec/names.txt
expected error code 0, got 1.
STDERR MISMATCH:
--- expected
+++ actual
@@ -0,0 +1,139 @@
+In file included from out/test/wasm2c/spec/names/names.2.c:5:
+out/test/wasm2c/spec/names/names.2.h:119:38: error: unpaired UTF-8 bidirectional control characters detected [-Werror=bidi-chars=]
+ 119 | extern u32 (*WASM_RT_ADD_PREFIX(Z_ZEFZBFZAFZE2Z80Z8BZC2ZA0ZC2ZADZE2Z81ZA0ZE1Z9AZ80ZE2Z80ZAEZE2Z80ZADZ_iv))(void);
+ | ~~~~~~ ^
+ | | | |
+ | | | end of bidirectional context
+ | | U+202D (LEFT-TO-RIGHT OVERRIDE)
+ | U+202E (RIGHT-TO-LEFT OVERRIDE)
+out/test/wasm2c/spec/names/names.2.h:121:55: error: unpaired UTF-8 bidirectional control characters detected [-Werror=bidi-chars=]
+ 121 | extern u32 (*WASM_RT_ADD_PREFIX(Z_ZE2Z80Z8EZE2Z80Z8FZE2Z80Z91ZE2Z80ZA8ZE2Z80ZA9ZE2Z80ZAAZE2Z80ZABZE2Z80ZACZE2Z80ZAFZE2Z81ZA6ZE2Z81ZA7ZE2Z81ZA8ZE2Z81ZA9Z_iv))(void);
+ | ~~~ ~~~~~~ ^
+ | | | | |
+ | | | | end of bidirectional context
+ | | | U+2067 (RIGHT-TO-LEFT ISOLATE)
+ | | U+2066 (LEFT-TO-RIGHT ISOLATE)
+ | U+202A (LEFT-TO-RIGHT EMBEDDING)
+out/test/wasm2c/spec/names/names.2.h:332:22: error: unpaired UTF-8 bidirectional control character detected [-Werror=bidi-chars=]
+ 332 | extern u32 (*WASM_RT_ADD_PREFIX(Z_ZE2Z80ZAEcbaZ_iv))(void);
+ | ~~~ ^
+ | | |
+ | | end of bidirectional context
+ | U+202D (LEFT-TO-RIGHT OVERRIDE)
+out/test/wasm2c/spec/names/names.2.h:334:22: error: unpaired UTF-8 bidirectional control character detected [-Werror=bidi-chars=]
+ 334 | extern u32 (*WASM_RT_ADD_PREFIX(Z_ZE2Z80ZADabcZE2Z80ZAEZ_iv))(void);
+ | ~~~ ^
+ | | |
+ | | end of bidirectional context
+ | U+202E (RIGHT-TO-LEFT OVERRIDE)
+out/test/wasm2c/spec/names/names.2.h:336:25: error: unpaired UTF-8 bidirectional control characters detected [-Werror=bidi-chars=]
+ 336 | extern u32 (*WASM_RT_ADD_PREFIX(Z_ZE2Z80ZAEcbaZE2Z80ZADZ_iv))(void);
+ | ~~~ ~~~ ^
+ | | | |
+ | | | end of bidirectional context
+ | | U+202E (RIGHT-TO-LEFT OVERRIDE)
+ | U+202D (LEFT-TO-RIGHT OVERRIDE)
+out/test/wasm2c/spec/names/names.2.h:338:25: error: unpaired UTF-8 bidirectional control characters detected [-Werror=bidi-chars=]
+ 338 | extern u32 (*WASM_RT_ADD_PREFIX(Z_ZF0Z9DZ91ZA8Z_iv))(void);
+ | ~~~ ~~~ ^
+ | | | |
+ | | | end of bidirectional context
+ | | U+202D (LEFT-TO-RIGHT OVERRIDE)
+ | U+202E (RIGHT-TO-LEFT OVERRIDE)
+out/test/wasm2c/spec/names/names.2.c:4700:38: error: unpaired UTF-8 bidirectional control characters detected [-Werror=bidi-chars=]
+ 4700 | u32 (*WASM_RT_ADD_PREFIX(Z_ZEFZBFZAFZE2Z80Z8BZC2ZA0ZC2ZADZE2Z81ZA0ZE1Z9AZ80ZE2Z80ZAEZE2Z80ZADZ_iv))(void);
+ | ~~~~~~ ^
+ | | | |
+ | | | end of bidirectional context
+ | | U+202D (LEFT-TO-RIGHT OVERRIDE)
+ | U+202E (RIGHT-TO-LEFT OVERRIDE)
+out/test/wasm2c/spec/names/names.2.c:4702:55: error: unpaired UTF-8 bidirectional control characters detected [-Werror=bidi-chars=]
+ 4702 | u32 (*WASM_RT_ADD_PREFIX(Z_ZE2Z80Z8EZE2Z80Z8FZE2Z80Z91ZE2Z80ZA8ZE2Z80ZA9ZE2Z80ZAAZE2Z80ZABZE2Z80ZACZE2Z80ZAFZE2Z81ZA6ZE2Z81ZA7ZE2Z81ZA8ZE2Z81ZA9Z_iv))(void);
+ | ~~~ ~~~~~~ ^
+ | | | | |
+ | | | | end of bidirectional context
+ | | | U+2067 (RIGHT-TO-LEFT ISOLATE)
+ | | U+2066 (LEFT-TO-RIGHT ISOLATE)
+ | U+202A (LEFT-TO-RIGHT EMBEDDING)
+out/test/wasm2c/spec/names/names.2.c:4913:22: error: unpaired UTF-8 bidirectional control character detected [-Werror=bidi-chars=]
+ 4913 | u32 (*WASM_RT_ADD_PREFIX(Z_ZE2Z80ZAEcbaZ_iv))(void);
+ | ~~~ ^
+ | | |
+ | | end of bidirectional context
+ | U+202D (LEFT-TO-RIGHT OVERRIDE)
+out/test/wasm2c/spec/names/names.2.c:4915:22: error: unpaired UTF-8 bidirectional control character detected [-Werror=bidi-chars=]
+ 4915 | u32 (*WASM_RT_ADD_PREFIX(Z_ZE2Z80ZADabcZE2Z80ZAEZ_iv))(void);
+ | ~~~ ^
+ | | |
+ | | end of bidirectional context
+ | U+202E (RIGHT-TO-LEFT OVERRIDE)
+out/test/wasm2c/spec/names/names.2.c:4917:25: error: unpaired UTF-8 bidirectional control characters detected [-Werror=bidi-chars=]
+ 4917 | u32 (*WASM_RT_ADD_PREFIX(Z_ZE2Z80ZAEcbaZE2Z80ZADZ_iv))(void);
+ | ~~~ ~~~ ^
+ | | | |
+ | | | end of bidirectional context
+ | | U+202E (RIGHT-TO-LEFT OVERRIDE)
+ | U+202D (LEFT-TO-RIGHT OVERRIDE)
+out/test/wasm2c/spec/names/names.2.c:4919:25: error: unpaired UTF-8 bidirectional control characters detected [-Werror=bidi-chars=]
+ 4919 | u32 (*WASM_RT_ADD_PREFIX(Z_ZF0Z9DZ91ZA8Z_iv))(void);
+ | ~~~ ~~~ ^
+ | | | |
+ | | | end of bidirectional context
+ | | U+202D (LEFT-TO-RIGHT OVERRIDE)
+ | U+202E (RIGHT-TO-LEFT OVERRIDE)
+out/test/wasm2c/spec/names/names.2.c: In function ‘init_exports’:
+out/test/wasm2c/spec/names/names.2.c:5667:22: error: unpaired UTF-8 bidirectional control characters detected [-Werror=bidi-chars=]
+ 5667 | /* export: '<U+206A><U+206B><U+206C><U+206D><U+206E><U+206F>' */
+ | ~~~~~~~~ ^
+ | | | |
+ | | | end of bidirectional context
+ | | U+202D (LEFT-TO-RIGHT OVERRIDE)
+ | U+202E (RIGHT-TO-LEFT OVERRIDE)
+out/test/wasm2c/spec/names/names.2.c:5669:45: error: unpaired UTF-8 bidirectional control characters detected [-Werror=bidi-chars=]
+ 5669 | /* export: '<U+2061><U+2062><U+2063><U+2064>' */
+ | ~ ^
+ | | | | |
+ | | | | end of bidirectional context
+ | | | U+2067 (RIGHT-TO-LEFT ISOLATE)
+ | | U+2066 (LEFT-TO-RIGHT ISOLATE)
+ | U+202A (LEFT-TO-RIGHT EMBEDDING)
+out/test/wasm2c/spec/names/names.2.c:5880:18: error: unpaired UTF-8 bidirectional control character detected [-Werror=bidi-chars=]
+ 5880 | /* export: '<U+202E>cba<U+202D>' */
+ | ~~~~~~~~ ^
+ | | |
+ | | end of bidirectional context
+ | U+202D (LEFT-TO-RIGHT OVERRIDE)
+out/test/wasm2c/spec/names/names.2.c:5882:21: error: unpaired UTF-8 bidirectional control character detected [-Werror=bidi-chars=]
+ 5882 | /* export: '<U+1D468>' */
+ | ~~~~~~~~~~~~ ^
+ | | |
+ | | end of bidirectional context
+ | U+202E (RIGHT-TO-LEFT OVERRIDE)
+out/test/wasm2c/spec/names/names.2.c:5884:24: error: unpaired UTF-8 bidirectional control characters detected [-Werror=bidi-chars=]
+ 5884 | /* export: '<U+1D434>' */
+ | ~~~~~~~~~~~~~ ^
+ | | | |
+ | | | end of bidirectional context
+ | | U+202E (RIGHT-TO-LEFT OVERRIDE)
+ | U+202D (LEFT-TO-RIGHT OVERRIDE)
+out/test/wasm2c/spec/names/names.2.c:5886:24: error: unpaired UTF-8 bidirectional control characters detected [-Werror=bidi-chars=]
+ 5886 | /* export: '<U+1D608>' */
+ | ~~~~~~~~~~~~~ ^
+ | | | |
+ | | | end of bidirectional context
+ | | U+202D (LEFT-TO-RIGHT OVERRIDE)
+ | U+202E (RIGHT-TO-LEFT OVERRIDE)
+At top level:
+cc1: note: unrecognized command-line option ‘-Wno-tautological-constant-out-of-range-compare’ may have been intended to silence earlier diagnostics
+cc1: all warnings being treated as errors
+Traceback (most recent call last):
+ File "/builddir/build/BUILD/wabt-1.0.28/test/run-spec-wasm2c.py", line 497, in <module>
+ sys.exit(main(sys.argv[1:]))
+ File "/builddir/build/BUILD/wabt-1.0.28/test/run-spec-wasm2c.py", line 471, in main
+ o_filenames.append(Compile(cc, c_filename, out_dir, includes, defines))
+ File "/builddir/build/BUILD/wabt-1.0.28/test/run-spec-wasm2c.py", line 357, in Compile
+ cc.RunWithArgsForStdout(*args)
+ File "/builddir/build/BUILD/wabt-1.0.28/test/utils.py", line 88, in RunWithArgsForStdout
+ raise error
+utils.Error: Error running "cc -I/builddir/build/BUILD/wabt-1.0.28/wasm2c -DWASM_RT_MODULE_PREFIX=Z_names_2 -c out/test/wasm2c/spec/names/names.2.c -o out/test/wasm2c/spec/names/names.2.o -Wall -Werror -Wno-unused -Wno-tautological-constant-out-of-range-compare -std=c99 -D_DEFAULT_SOURCE" (1):
+None
STDOUT MISMATCH:
--- expected
+++ actual
@@ -1,3 +0,0 @@
-spectest.print_i32(42)
-spectest.print_i32(123)
-482/482 tests passed.
+ test/wasm2c/spec/nop.txt (0.361s)
+ test/wasm2c/spec/return.txt (0.333s)
+ test/wasm2c/spec/stack.txt (0.336s)
- test/wasm2c/spec/skip-stack-guard-page.txt
expected error code 0, got 1.
STDERR MISMATCH:
--- expected
+++ actual
@@ -0,0 +1,21 @@
+out/test/wasm2c/spec/skip-stack-guard-page/skip-stack-guard-page.0.c: In function ‘w2c_f1’:
+out/test/wasm2c/spec/skip-stack-guard-page/skip-stack-guard-page.0.c:322:13: error: infinite recursion detected [-Werror=infinite-recursion]
+ 322 | static void w2c_f1(void) {
+ | ^~~~~~
+out/test/wasm2c/spec/skip-stack-guard-page/skip-stack-guard-page.0.c:458:3: note: recursive call
+ 458 | w2c_f1();
+ | ^~~~~~~~
+At top level:
+cc1: note: unrecognized command-line option ‘-Wno-tautological-constant-out-of-range-compare’ may have been intended to silence earlier diagnostics
+cc1: all warnings being treated as errors
+Traceback (most recent call last):
+ File "/builddir/build/BUILD/wabt-1.0.28/test/run-spec-wasm2c.py", line 497, in <module>
+ sys.exit(main(sys.argv[1:]))
+ File "/builddir/build/BUILD/wabt-1.0.28/test/run-spec-wasm2c.py", line 471, in main
+ o_filenames.append(Compile(cc, c_filename, out_dir, includes, defines))
+ File "/builddir/build/BUILD/wabt-1.0.28/test/run-spec-wasm2c.py", line 357, in Compile
+ cc.RunWithArgsForStdout(*args)
+ File "/builddir/build/BUILD/wabt-1.0.28/test/utils.py", line 88, in RunWithArgsForStdout
+ raise error
+utils.Error: Error running "cc -I/builddir/build/BUILD/wabt-1.0.28/wasm2c -DWASM_RT_MODULE_PREFIX=Z_skip_stack_guard_page_0 -c out/test/wasm2c/spec/skip-stack-guard-page/skip-stack-guard-page.0.c -o out/test/wasm2c/spec/skip-stack-guard-page/skip-stack-guard-page.0.o -Wall -Werror -Wno-unused -Wno-tautological-constant-out-of-range-compare -std=c99 -D_DEFAULT_SOURCE" (1):
+None
STDOUT MISMATCH:
--- expected
+++ actual
@@ -1 +0,0 @@
-10/10 tests passed.
+ test/wasm2c/spec/start.txt (0.412s)
...
**** FAILED ******************************************************************
- test/wasm2c/spec/call.txt
/usr/bin/python3 /builddir/build/BUILD/wabt-1.0.28/test/run-spec-wasm2c.py out/test/wasm2c/spec/call.wast --bindir=redhat-linux-build --no-error-cmdline -o out/test/wasm2c/spec/call
- test/wasm2c/spec/names.txt
/usr/bin/python3 /builddir/build/BUILD/wabt-1.0.28/test/run-spec-wasm2c.py out/test/wasm2c/spec/names.wast --bindir=redhat-linux-build --no-error-cmdline -o out/test/wasm2c/spec/names
- test/wasm2c/spec/skip-stack-guard-page.txt
/usr/bin/python3 /builddir/build/BUILD/wabt-1.0.28/test/run-spec-wasm2c.py out/test/wasm2c/spec/skip-stack-guard-page.wast --bindir=redhat-linux-build --no-error-cmdline -o out/test/wasm2c/spec/skip-stack-guard-page
```
The warnings can be silenced and I'll provide a PR soon.
|
testsuite failures due to new warnings in GCC 12
|
https://api.github.com/repos/WebAssembly/wabt/issues/1885/comments
| 1 |
2022-04-04T08:13:52Z
|
2023-03-15T02:06:03Z
|
https://github.com/WebAssembly/wabt/issues/1885
| 1,191,419,770 | 1,885 |
[
"WebAssembly",
"wabt"
] |
This is the wat file used:
```wat
(module
(func $how_old (param $year_now i32) (param $year_born i32) (result i32)
get_local $year_now
get_local $year_born
i32.sub)
(export "how_old" (func $how_old))
)
```
I am using the binary for 1.0.28
|
wat2wasm failing with: unexpected token get_local, expected ).
|
https://api.github.com/repos/WebAssembly/wabt/issues/1883/comments
| 3 |
2022-04-02T17:03:22Z
|
2022-04-03T04:20:40Z
|
https://github.com/WebAssembly/wabt/issues/1883
| 1,190,685,597 | 1,883 |
[
"WebAssembly",
"wabt"
] |
Non-null references are opcode `-0x15` and are supported already in wabt. Nullable references (opcode `-0x14`) should also be supported.
https://github.com/WebAssembly/function-references/blob/main/proposals/function-references/Overview.md#binary-format
|
Typed funcref support should include nullable references
|
https://api.github.com/repos/WebAssembly/wabt/issues/1882/comments
| 0 |
2022-04-01T18:46:37Z
|
2022-04-01T18:46:46Z
|
https://github.com/WebAssembly/wabt/issues/1882
| 1,190,154,931 | 1,882 |
[
"WebAssembly",
"wabt"
] |
A test like the following currently crashes in type-checking:
```
;;; TOOL: wat2wasm
;;; ARGS: --enable-function-references
;;; ERROR: 1
(module
(type $f32-f32-1 (func (param f32) (result f32)))
(type $f32-f32-2 (func (param f32) (result f32)))
(func $foo (param $f (ref $f32-f32-1)) (result f32)
(call_ref (f32.const 42.0) (local.get $f))
)
(func $bar (type $f32-f32-2)
(f32.const 1.0)
)
(func (export "main") (result f32)
;; $f32-f32-1 and $f32-f32-2 should be equal
(call $foo (ref.func $bar))
)
(elem declare funcref (ref.func $bar))
)
(;; STDERR ;;;
;;; STDERR ;;)
```
Error:
```
- test/typecheck/funcref-equality.txt (roundtrip)
b'Signal raised running "wat2wasm": SIGABRT\nwat2wasm: ../../../src/type.h:132: wabt::Index wabt::Type::GetReferenceIndex() const: Assertion `enum_ == Enum::Reference\' failed.\n'
```
I think the immediate reason is that type checking should account for subtyping, and make sure to compare heap types instead of assuming all reference types have an index (i.e., are a "concrete reference type" as described in the GC spec).
More generally, I think the type-checker needs to also be extended to look at the type section (or a more abstract "type store") to look up type indices when checking equality of concrete types. Alternatively, concrete ref types should be stored pre-canonicalized as a pointer (this would depend on https://github.com/WebAssembly/wabt/pull/1828) to a representative type in the canonicalized type store.
These are all needed eventually for GC support too.
|
Type funcref crash due to ref type getting read as "any" type instead of a ref type
|
https://api.github.com/repos/WebAssembly/wabt/issues/1881/comments
| 1 |
2022-04-01T17:15:47Z
|
2022-04-04T23:36:38Z
|
https://github.com/WebAssembly/wabt/issues/1881
| 1,190,074,424 | 1,881 |
[
"WebAssembly",
"wabt"
] |
On line 311, undefined is spelled as undefine.
@nickvidal can I work on this?
|
Omitted letter in word in the README.md file
|
https://api.github.com/repos/WebAssembly/wabt/issues/1879/comments
| 0 |
2022-04-01T12:18:54Z
|
2022-04-04T16:49:18Z
|
https://github.com/WebAssembly/wabt/issues/1879
| 1,189,715,160 | 1,879 |
[
"WebAssembly",
"wabt"
] |
1.24 has no problem, but current versions including latest mistake the table element ID for re-defining the element:
```bash
~/Downloads/wabt-1.0.28/bin/wast2json --debug-names ./tests/spectest/testdata/elem.wast
./tests/spectest/testdata/elem.wast:16:4: error: redefinition of elem "$t"
(elem $t (i32.const 0) $f $f)
^^^^
./tests/spectest/testdata/elem.wast:17:4: error: redefinition of elem "$t"
(elem $t (offset (i32.const 0)))
^^^^
./tests/spectest/testdata/elem.wast:18:4: error: redefinition of elem "$t"
(elem $t (offset (i32.const 0)) $f $f)
^^^^
```
|
Issue decoding table elements
|
https://api.github.com/repos/WebAssembly/wabt/issues/1878/comments
| 7 |
2022-04-01T06:22:31Z
|
2022-04-14T00:11:12Z
|
https://github.com/WebAssembly/wabt/issues/1878
| 1,189,302,941 | 1,878 |
[
"WebAssembly",
"wabt"
] |
There is some support for the GC proposal in wabt already behind a flag, but it predates the current design for the proposal (that recently went to phase 2) that includes new type constructs like `rec`, `sub`, and so on.
Now that the design is more stable, it could be a good time to catch up support in wabt. I'm interested in working on this if nobody already has patches in progress.
|
Update GC proposal support to recent phase 2 version
|
https://api.github.com/repos/WebAssembly/wabt/issues/1874/comments
| 3 |
2022-03-30T17:11:08Z
|
2023-12-14T17:04:38Z
|
https://github.com/WebAssembly/wabt/issues/1874
| 1,186,754,270 | 1,874 |
[
"WebAssembly",
"wabt"
] | null |
add an homebrew method of installation for all tools
|
https://api.github.com/repos/WebAssembly/wabt/issues/1873/comments
| 8 |
2022-03-28T14:07:37Z
|
2022-03-29T15:18:20Z
|
https://github.com/WebAssembly/wabt/issues/1873
| 1,183,498,549 | 1,873 |
[
"WebAssembly",
"wabt"
] |
Attempting to use wat2wasm.exe on Twitch's source, downloadable [here](https://static.twitchcdn.net/assets/amazon-ivs-wasmworker.min-516e603bd6ff6160ceb3.wasm), produces this error:
`wat2wasm.exe amazon-ivs-wasmworker.min-516e603bd6ff6160ceb3.wasm -o out.wasm`
```
amazon-ivs-wasmworker.min-516e603bd6ff6160ceb3.wasm:202831:7: error: unexpected token current_memory, expected end.
current_memory
^^^^^^^^^^^^^^
```
Followed by two more errors which I assume cascaded from the first. Did I do something wrong? I'm not familiar with wasm but a quick search suggests current_memory is a valid op.
|
wat2wasm error: unexpected token current_memory
|
https://api.github.com/repos/WebAssembly/wabt/issues/1868/comments
| 3 |
2022-03-17T12:56:19Z
|
2022-03-22T21:08:25Z
|
https://github.com/WebAssembly/wabt/issues/1868
| 1,172,349,579 | 1,868 |
[
"WebAssembly",
"wabt"
] |
@sbc100
I have updated the test suite according to your suggestion.
There are 94 new failures introduced. Output:
https://gist.github.com/zherczeg/be736057cf92b09c1d6eed752f548c4b
The following files are added (count: 81). It seems all of them fails, although I have not checked all of them. Maybe these needs to be skipped. I saw some skipping mechanism in `update-spec-tests.py` but it looks like it skips entire modules.
```
test/wasm2c/spec/br_table.txt
test/wasm2c/spec/bulk.txt
test/wasm2c/spec/call_indirect.txt
test/wasm2c/spec/elem.txt
test/wasm2c/spec/exports.txt
test/wasm2c/spec/global.txt
test/wasm2c/spec/imports.txt
test/wasm2c/spec/linking.txt
test/wasm2c/spec/memory_copy.txt
test/wasm2c/spec/memory_fill.txt
test/wasm2c/spec/memory_init.txt
test/wasm2c/spec/ref_func.txt
test/wasm2c/spec/ref_is_null.txt
test/wasm2c/spec/ref_null.txt
test/wasm2c/spec/select.txt
test/wasm2c/spec/simd_address.txt
test/wasm2c/spec/simd_align.txt
test/wasm2c/spec/simd_bit_shift.txt
test/wasm2c/spec/simd_bitwise.txt
test/wasm2c/spec/simd_boolean.txt
test/wasm2c/spec/simd_const.txt
test/wasm2c/spec/simd_conversions.txt
test/wasm2c/spec/simd_f32x4.txt
test/wasm2c/spec/simd_f32x4_arith.txt
test/wasm2c/spec/simd_f32x4_cmp.txt
test/wasm2c/spec/simd_f32x4_pmin_pmax.txt
test/wasm2c/spec/simd_f32x4_rounding.txt
test/wasm2c/spec/simd_f64x2.txt
test/wasm2c/spec/simd_f64x2_arith.txt
test/wasm2c/spec/simd_f64x2_cmp.txt
test/wasm2c/spec/simd_f64x2_pmin_pmax.txt
test/wasm2c/spec/simd_f64x2_rounding.txt
test/wasm2c/spec/simd_i16x8_arith.txt
test/wasm2c/spec/simd_i16x8_arith2.txt
test/wasm2c/spec/simd_i16x8_cmp.txt
test/wasm2c/spec/simd_i16x8_extadd_pairwise_i8x16.txt
test/wasm2c/spec/simd_i16x8_extmul_i8x16.txt
test/wasm2c/spec/simd_i16x8_q15mulr_sat_s.txt
test/wasm2c/spec/simd_i16x8_sat_arith.txt
test/wasm2c/spec/simd_i32x4_arith.txt
test/wasm2c/spec/simd_i32x4_arith2.txt
test/wasm2c/spec/simd_i32x4_cmp.txt
test/wasm2c/spec/simd_i32x4_dot_i16x8.txt
test/wasm2c/spec/simd_i32x4_extadd_pairwise_i16x8.txt
test/wasm2c/spec/simd_i32x4_extmul_i16x8.txt
test/wasm2c/spec/simd_i32x4_trunc_sat_f32x4.txt
test/wasm2c/spec/simd_i32x4_trunc_sat_f64x2.txt
test/wasm2c/spec/simd_i64x2_arith.txt
test/wasm2c/spec/simd_i64x2_arith2.txt
test/wasm2c/spec/simd_i64x2_cmp.txt
test/wasm2c/spec/simd_i64x2_extmul_i32x4.txt
test/wasm2c/spec/simd_i8x16_arith.txt
test/wasm2c/spec/simd_i8x16_arith2.txt
test/wasm2c/spec/simd_i8x16_cmp.txt
test/wasm2c/spec/simd_i8x16_sat_arith.txt
test/wasm2c/spec/simd_int_to_int_extend.txt
test/wasm2c/spec/simd_lane.txt
test/wasm2c/spec/simd_load.txt
test/wasm2c/spec/simd_load16_lane.txt
test/wasm2c/spec/simd_load32_lane.txt
test/wasm2c/spec/simd_load64_lane.txt
test/wasm2c/spec/simd_load8_lane.txt
test/wasm2c/spec/simd_load_extend.txt
test/wasm2c/spec/simd_load_splat.txt
test/wasm2c/spec/simd_load_zero.txt
test/wasm2c/spec/simd_splat.txt
test/wasm2c/spec/simd_store.txt
test/wasm2c/spec/simd_store16_lane.txt
test/wasm2c/spec/simd_store32_lane.txt
test/wasm2c/spec/simd_store64_lane.txt
test/wasm2c/spec/simd_store8_lane.txt
test/wasm2c/spec/table-sub.txt
test/wasm2c/spec/table.txt
test/wasm2c/spec/table_copy.txt
test/wasm2c/spec/table_fill.txt
test/wasm2c/spec/table_get.txt
test/wasm2c/spec/table_grow.txt
test/wasm2c/spec/table_init.txt
test/wasm2c/spec/table_set.txt
test/wasm2c/spec/table_size.txt
test/wasm2c/spec/unreached-valid.txt
```
Some of them requires improved dumping, they are probably not that difficult to fix. Maybe they could be done in separate patches.
What do you recommend to do next?
|
Update test suite
|
https://api.github.com/repos/WebAssembly/wabt/issues/1867/comments
| 1 |
2022-03-17T09:21:24Z
|
2022-04-01T18:11:38Z
|
https://github.com/WebAssembly/wabt/issues/1867
| 1,172,124,620 | 1,867 |
[
"WebAssembly",
"wabt"
] |
I'm not quite sure if this a bug, but I think it's not quite in sync with the official spec.
From my wasm file's disassembly, wasm-objdump generate the following line:
```
00b994: 11 87 80 80 80 00 00 | call_indirect 7 0
```
This here should have the type index 7 and the table index 0. Unfortunately, it seems that this is reversed. The [binary docs](https://webassembly.github.io/spec/core/binary/instructions.html#control-instructions) write:
```
0x11 y:typeidx x:tableidx => call_indirect x y
```
I'm not sure why this is reversed, but I think it's a bit misleading (At least it confused me while implementing my Webassembly runtime :D).
|
call_indirect in wasm-objdump switches x and y
|
https://api.github.com/repos/WebAssembly/wabt/issues/1865/comments
| 7 |
2022-03-12T21:53:15Z
|
2022-03-17T17:56:15Z
|
https://github.com/WebAssembly/wabt/issues/1865
| 1,167,410,684 | 1,865 |
[
"WebAssembly",
"wabt"
] |
This is probably not within the purvey of `WebAssembly` though you are th experts re compilation/decompilation of native code, and Google recommends migrating from Native Client to WebAssembly https://developer.chrome.com/docs/native-client/migration/.
Google released an extension which relies on Native Client that includes a voice that can be used with Web Speech API `window.speechSynthsis.speak()`. In that extension exists speech synthesis engine in the form of .nexe [US English Female Text-to-speech (by Google](https://chrome.google.com/webstore/detail/us-english-female-text-to/pkidpnnapnfgjhfhkpmjpbckkbaodldb).
What I want to do is extract the C++ source code from the .nexe file and migrate from the deprecated Native Client to WebAssembly.
How do I achieve that?
|
How to extract source code from Native Client .nexe file, migrate to WebAssembly?
|
https://api.github.com/repos/WebAssembly/wabt/issues/1864/comments
| 8 |
2022-03-12T16:29:31Z
|
2022-03-14T01:20:35Z
|
https://github.com/WebAssembly/wabt/issues/1864
| 1,167,333,582 | 1,864 |
[
"WebAssembly",
"wabt"
] |
My wat is :
```
(module
(func $thirteen (result i32) (i32.const 13))
(func $fourtytwo (result i32) (i32.const 42))
(table (export "tbl") anyfunc (elem $thirteen $fourtytwo))
)
```
when i excute :
`wat2wasm table.wat -o table.wasm`
I get an error:
```
table.wat:4:25: error: unexpected token "anyfunc", expected a natural number (e.g. 123).
(table (export "tbl") anyfunc (elem $thirteen $fourtytwo))
^^^^^^^
table.wat:4:49: error: undefined table variable "$fourtytwo"
(table (export "tbl") anyfunc (elem $thirteen $fourtytwo))
```
wat2wasm do not support anyfunc?
|
unexpected token "anyfunc", expected a natural number
|
https://api.github.com/repos/WebAssembly/wabt/issues/1863/comments
| 3 |
2022-03-11T10:05:31Z
|
2022-03-30T19:17:26Z
|
https://github.com/WebAssembly/wabt/issues/1863
| 1,166,228,497 | 1,863 |
[
"WebAssembly",
"wabt"
] |
;tldr; I think we should.
It has been proposed in #1833 that we don't need to be mangling the names at all (except to turn them into valid C symbols).
In particular there is no need to append the mangled signature to the symbol names. e.g. foo_vi (for a void function `foo` that takes an i32).
For exports there should be no issue at all since exports already need to have unique names. However, wasm has historically allowed the same symbol to imported with various different signatures. In particular the test suite it self used to do this when it imported the same `spectest.print` symbol with various signatures. However, this was (conveniently) removed in https://github.com/WebAssembly/spec/pull/652. In the design repo there was some discussion of removing duplicate imports: https://github.com/WebAssembly/design/issues/1402. However that doesn't seem like its doing to happen. In fact the discussion seems to be moving towards giving the host more power to link module together based on both names and positions (and signatures) of the imports.
Based the above it seems like the naive linking scheme we currently have is already insufficient and not general enough to provide all the things that a wasm host might want to do.. so I propose that we remove name mangling and add a more powerful linking mechanism (that is not just based on the symbol resolution in the linker) if we even need one.
|
Should we remove signature mangling from wasm2c output?
|
https://api.github.com/repos/WebAssembly/wabt/issues/1858/comments
| 8 |
2022-03-09T19:25:18Z
|
2022-04-14T07:58:11Z
|
https://github.com/WebAssembly/wabt/issues/1858
| 1,164,345,903 | 1,858 |
[
"WebAssembly",
"wabt"
] |
Currently it seems these are the only tests that test `--disable-`:
- https://github.com/WebAssembly/wabt/blob/1f3a1d5fae0296fdf503968131905be9e8f40cf4/test/parse/expr/atomic-disabled.txt
- https://github.com/WebAssembly/wabt/blob/1f3a1d5fae0296fdf503968131905be9e8f40cf4/test/parse/expr/bulk-memory-disabled.txt
- https://github.com/WebAssembly/wabt/blob/1f3a1d5fae0296fdf503968131905be9e8f40cf4/test/parse/expr/tail-call-disabled.txt
- https://github.com/WebAssembly/wabt/blob/30c1e983d30b33a8004b39fd60cbd64477a7956c/test/parse/module/reference-types-disabled.txt
It might be a good idea to add more of these, and make sure they apply to all the other tools, like `wasm2c`, too.
|
There should be more tests for --enable- and --disable-
|
https://api.github.com/repos/WebAssembly/wabt/issues/1837/comments
| 1 |
2022-02-22T16:05:12Z
|
2022-02-22T16:07:20Z
|
https://github.com/WebAssembly/wabt/issues/1837
| 1,147,093,907 | 1,837 |
[
"WebAssembly",
"wabt"
] |
Running the 1.0.25 testsuite on 32-bit ARM and 32-bit x86 yields failures in these tests:
```
dump/reference-types.txt
dump/relocations-all-features.txt
dump/relocations.txt
dump/table.txt
```
I can reproduce this across all currently supported Fedora releases (34, 35 and rawhide).
Log extract below:
```
[...]
- test/dump/reference-types.txt
STDOUT MISMATCH:
--- expected
+++ actual
@@ -24,7 +24,7 @@
- segment[0] flags=2 table=2 count=1 - init i32=0
- elem[0] = func[0]
- segment[1] flags=5 table=0 count=1
- - elem[0] = ref.null funcref
+ - elem[0] = ref.null (null)
Code[10]:
- func[0] size=6
- func[1] size=6
- test/dump/relocations-all-features.txt
STDOUT MISMATCH:
--- expected
+++ actual
@@ -28,7 +28,7 @@
- func[2] <f> -> "f"
Elem[1]:
- segment[0] flags=0 table=0 count=1 - init i32=0
- - elem[0] = func[1] <__extern.bar>
+ - elem[0] = func[0] <__extern.bar>
Code[1]:
- func[2] size=36 <f>
Custom:
+ test/dump/relocations-block-types.txt (0.032s)
+ test/dump/relocations-long-func-bodies.txt (0.027s)
+ test/dump/relocations-long-func-section.txt (0.030s)
+ test/dump/relocations-section-target.txt (0.024s)
- test/dump/relocations.txt
STDOUT MISMATCH:
--- expected
+++ actual
@@ -28,7 +28,7 @@
- func[2] <f> -> "f"
Elem[1]:
- segment[0] flags=0 table=0 count=1 - init i32=0
- - elem[0] = func[1] <__extern.bar>
+ - elem[0] = func[0] <__extern.bar>
Code[1]:
- func[2] size=36 <f>
Custom:
+ test/dump/result.txt (0.046s)
+ test/dump/rethrow.txt (0.031s)
+ test/dump/return.txt (0.033s)
+ test/dump/section-offsets.txt (0.028s)
+ test/dump/select.txt (0.033s)
+ test/dump/setglobal.txt (0.032s)
+ test/dump/setlocal-param.txt (0.039s)
+ test/dump/setlocal.txt (0.037s)
+ test/dump/signatures.txt (0.040s)
+ test/dump/simd-basic.txt (0.022s)
+ test/dump/simd-binary.txt (0.040s)
+ test/dump/simd-bitselect.txt (0.027s)
+ test/dump/simd-compare.txt (0.028s)
+ test/dump/simd-lane.txt (0.025s)
+ test/dump/simd-load-lane.txt (0.024s)
+ test/dump/simd-load-store.txt (0.028s)
+ test/dump/simd-splat.txt (0.025s)
+ test/dump/simd-shift.txt (0.032s)
+ test/dump/simd-store-lane.txt (0.034s)
+ test/dump/simd-unary.txt (0.033s)
+ test/dump/start.txt (0.037s)
+ test/dump/store-aligned.txt (0.047s)
+ test/dump/store.txt (0.048s)
+ test/dump/store64.txt (0.046s)
+ test/dump/string-escape.txt (0.036s)
+ test/dump/string-hex.txt (0.037s)
+ test/dump/struct.txt (0.029s)
+ test/dump/symbol-tables-all-features.txt (0.027s)
+ test/dump/symbol-tables.txt (0.025s)
+ test/dump/table-multi.txt (0.034s)
+ test/dump/tag.txt (0.030s)
- test/dump/table.txt
STDOUT MISMATCH:
--- expected
+++ actual
@@ -12,13 +12,13 @@
- table[0] type=funcref initial=6 max=6
Elem[2]:
- segment[0] flags=0 table=0 count=2 - init i32=0
- - elem[0] = func[1]
- - elem[1] = func[1]
+ - elem[0] = func[0]
+ - elem[1] = func[0]
- segment[1] flags=0 table=0 count=4 - init i32=2
- elem[2] = func[0]
- elem[3] = func[0]
- - elem[4] = func[1]
- - elem[5] = func[2]
+ - elem[4] = func[0]
+ - elem[5] = func[0]
Code[3]:
- func[0] size=2
- func[1] size=2
[...]
```
|
1.0.25: new test failures on 32-bit arches
|
https://api.github.com/repos/WebAssembly/wabt/issues/1822/comments
| 4 |
2022-02-08T09:24:59Z
|
2022-04-04T08:32:03Z
|
https://github.com/WebAssembly/wabt/issues/1822
| 1,126,994,136 | 1,822 |
[
"WebAssembly",
"wabt"
] |
Build from source on macOS 12.3 beta with cmake 3.19.2
The input file (add1.wat) should not contain any errors.
```
(module
(func $add (param $lhs i32) (param $rhs i32) (result i32)
get_local $lhs
get_local $rhs
i32.add)
(export "add" (func $add))
)
```
Run `wat2wasm add1.wat -o add.wasm`
Given error
```
add1.wat:3:5: error: unexpected token get_local, expected ).
get_local $lhs
^^^^^^^^^
add1.wat:4:5: error: unexpected token get_local.
get_local $rhs
^^^^^^^^^
```
|
wabt2wasm error: unexpected token get_local
|
https://api.github.com/repos/WebAssembly/wabt/issues/1820/comments
| 2 |
2022-02-04T05:58:54Z
|
2022-02-04T09:12:19Z
|
https://github.com/WebAssembly/wabt/issues/1820
| 1,123,846,818 | 1,820 |
[
"WebAssembly",
"wabt"
] |
I was inspecting the binary wasm file to clarify the wasm spec, and I noticed that version `1.0.23` of `wat2wasm` was producing non-canonical varints, for the `i32.const` I checked on the current main branch and it's a problem there too, it doesn't seem it was fixed by: https://github.com/WebAssembly/wabt/pull/1632
to reproduce:
```
(module
(func $get (export "get") (result i32)
(i32.const 64) ;; double byte varint!!!
;;(i32.const 63) ;; single byte varint
)
)
```
```
> wat2wasm params.wat && hexdump params.wasm -C
00000000 00 61 73 6d 01 00 00 00 01 05 01 60 00 01 7f 03 |.asm.......`....|
00000010 02 01 00 07 07 01 03 67 65 74 00 00 0a 07 01 05 |.......get......|
00000020 00 41 c0 00 0b |.A...|
00000025
```
that last line: `00 41 c0 00 0b`. 0x41 is encoding for `i32.const` which is followed by a varint. `c0 00` encodes 64, but so does `40`! (without needing another byte!) 8192 also uses 3 bytes to encode when it should only take 2.
|
wat2wasm produces non-cannonical varint
|
https://api.github.com/repos/WebAssembly/wabt/issues/1816/comments
| 2 |
2022-01-31T13:13:22Z
|
2023-02-13T08:47:26Z
|
https://github.com/WebAssembly/wabt/issues/1816
| 1,119,412,881 | 1,816 |
[
"WebAssembly",
"wabt"
] |
So far as I can tell, wasm-objdump doesn't use local names when printing instructions such as local.get. I wanted to check if this was so (rather than, for instance, my test file specifying the names incorrectly -- wasm2wat includes the names, so I assume this isn't the case), and whether there would be any interest in changing the behaviour to include the names of locals?
|
Local names in wasm-objdump -x
|
https://api.github.com/repos/WebAssembly/wabt/issues/1815/comments
| 1 |
2022-01-30T21:58:44Z
|
2022-02-02T20:27:44Z
|
https://github.com/WebAssembly/wabt/issues/1815
| 1,118,732,646 | 1,815 |
[
"WebAssembly",
"wabt"
] |
According to [the MVP spec](https://www.w3.org/TR/wasm-core-1/#text-functype), a type can include symbolic IDs for parameters. It [elaborates](https://www.w3.org/TR/wasm-core-1/#functions%E2%91%A2) that a function's local index is its parameters followed by its locals. Finally, it [states](https://www.w3.org/TR/wasm-core-1/#text-context) "An identifier context is well-formed if no index space contains duplicate identifiers."
Given this, I would expect uniqueness to be enforced both on parameter IDs within a type (or type use), locals within a function, and across parameters and locals in a function.
Right now, only one case seems to be validated: when a local redefines the same ID:
Ex.
```
(module
(func (result i32) (local $x i32) (local $x i32) local.get $x)
)
```
However, the other two combinations pass, and choose the last to define x (the function local):
1. Redefine param ID in the same type == local.get 2
```
(module
(func (type 0) (local $x i32) local.get $x)
(type (func (param $x i32) (param $x i32) (result i32)))
)
```
2. Redefine an ID on a local with the same ID as a parameter == local.get 1
```
(module
(func (type 0) (local $x i32) local.get $x)
(type (func (param $x i32) (result i32)))
)
```
The root cause may be around how local names inherit from the type func. For example, with the latest release, this fails to compile as it doesn't see the names on the type func.
```
(module
(func (type 0) local.get $x)
(type (func (param $x i32) (result i32)))
)
```
I'm not sure if unreleased code fixes this, but worth a look!
|
text format: local index isn't enforced on type parameter IDs
|
https://api.github.com/repos/WebAssembly/wabt/issues/1813/comments
| 1 |
2022-01-25T01:31:55Z
|
2022-01-26T23:25:10Z
|
https://github.com/WebAssembly/wabt/issues/1813
| 1,113,321,744 | 1,813 |
[
"WebAssembly",
"wabt"
] |
Why is WABT version 1.0.26 marked as a pre-release version and not the latest version?
My unit test use https://github.com/WebAssembly/wabt/releases/latest for execution and are broken.
|
1.0.26 Pre-release
|
https://api.github.com/repos/WebAssembly/wabt/issues/1812/comments
| 0 |
2022-01-22T13:48:08Z
|
2022-02-19T11:38:39Z
|
https://github.com/WebAssembly/wabt/issues/1812
| 1,111,569,221 | 1,812 |
[
"WebAssembly",
"wabt"
] |
Some features are really hard to implement without typed unions like std::variant and other features from c++17.
For example, with typed function references and gc proposal we have named types during parsing `(ref null $foo_func)` and `(ref null $struct_type)` but we can't just add `std::string` to struct Type because we use Type as a member of unions in `struct InitExpr` and `struct ActionResult`. So, in the end we need to maintain maps: type_name -> its index during parsing and this is awful because possibly any thing in WebAssembly from local and global to function and table can have named type.
It is 2022 and we still use c++ 2011, so I propose to move to c++17, wdyt? @sbc100
|
Move to c++ 17
|
https://api.github.com/repos/WebAssembly/wabt/issues/1811/comments
| 1 |
2022-01-21T12:33:40Z
|
2022-02-11T17:41:49Z
|
https://github.com/WebAssembly/wabt/issues/1811
| 1,110,421,726 | 1,811 |
[
"WebAssembly",
"wabt"
] |
Latest version 1.0.25 seems to fail reading param names following a type field. this is allowed by spec and works with wasm-tools. https://www.w3.org/TR/wasm-core-1/#type-uses%E2%91%A0
```
(module
(type $i32i32_i32 (func (param i32 i32) (result i32)))
(import "Math" "Mul" (func $mul (param $x f32) (param $y f32) (result f32)))
(import "Math" "Add" (func $add (type $i32i32_i32) (param $l i32) (param $r i32) (result i32)))
)
```
```
$ wat2wasm --debug-names --debug-parser -v example.wat
example.wat:4:53: error: unexpected token (, expected ).
... "Add" (func $add (type $i32i32_i32) (param $l i32) (param $r i32) (result...
^
```
|
Fails reading local name after inlined type
|
https://api.github.com/repos/WebAssembly/wabt/issues/1806/comments
| 3 |
2022-01-13T23:47:22Z
|
2022-01-15T00:17:42Z
|
https://github.com/WebAssembly/wabt/issues/1806
| 1,102,595,529 | 1,806 |
[
"WebAssembly",
"wabt"
] |
Hello all,
I would like to start a conversation about the best way to make wasm2c thread-safe so that the same module can be instantiated multiple times with different memory contexts, and functions from different instances can be executed in parallel. Our current plan was to move global memory variables into a structure and then pass a pointer to that structure as a parameter to every function call (Similar changes are also proposed by #1721). Before we draft a PR, I would like to see what are people’s thoughts about this. More details are below.
Since the changes we make introduce a new layer of abstraction, we were concerned about the potential increase of memory access latency. Therefore, we investigated the assembly code generated by the output of status quo wasm2c and a toy model of the expected output of our new version of wasm2c in terms of memory access. The assembly code is compiled with `clang -O2`. Both versions require 2 memory access for a memory store.
## Status quo wasm2c
Input wat file:
```wasm
(module
(memory $m1 1)
(func (export "store") (param i32 i32)
local.get 0
local.get 1
i32.store))
```
Assembly code compiled from wasm2c output:
```assembly
0000000000401240 <w2c_store>:
static void w2c_store(u32 w2c_p0, u32 w2c_p1) {
401240: 50 push %rax
FUNC_PROLOGUE;
401241: 8b 05 81 2e 00 00 mov 0x2e81(%rip),%eax # 4040c8 <wasm_rt_call_stack_depth>
401247: 83 c0 01 add $0x1,%eax
40124a: 89 05 78 2e 00 00 mov %eax,0x2e78(%rip) # 4040c8 <wasm_rt_call_stack_depth>
401250: 3d f5 01 00 00 cmp $0x1f5,%eax
401255: 73 15 jae 40126c <w2c_store+0x2c>
i32_store((&w2c_M0), (u64)(w2c_i0), w2c_i1);
401257: 89 f8 mov %edi,%eax
DEFINE_STORE(i32_store, u32, u32);
401259: 48 8b 0d 40 2e 00 00 mov 0x2e40(%rip),%rcx # 4040a0 <w2c_M0>
401260: 89 34 01 mov %esi,(%rcx,%rax,1)
FUNC_EPILOGUE;
401263: 83 05 5e 2e 00 00 ff addl $0xffffffff,0x2e5e(%rip) # 4040c8 <wasm_rt_call_stack_depth>
}
40126a: 58 pop %rax
40126b: c3 ret
FUNC_PROLOGUE;
40126c: bf 07 00 00 00 mov $0x7,%edi
401271: e8 0a 00 00 00 call 401280 <wasm_rt_trap>
401276: 66 2e 0f 1f 84 00 00 cs nopw 0x0(%rax,%rax,1)
40127d: 00 00 00
```
There are two memory access for the actual `i32_store`, `401259: 48 8b 0d 40 2e 00 00 mov 0x2e40(%rip),%rcx` for storing the address of `w2c_M0->data` to a register and `401260: 89 34 01 mov %esi,(%rcx,%rax,1)` for the actual storing.
## Toy model of the expected output after our changes
`program.cc`
```c++
#include <stdint.h>
typedef struct {
uint8_t* data;
uint32_t size;
} wasm_rt_memory_t;
typedef struct {
wasm_rt_memory_t memoryone;
wasm_rt_memory_t memorytwo;
} memories;
void i8_store(memories* mem, uint8_t val, uint32_t idx);
uint8_t i8_load(memories* mem, uint32_t idx);
int start(memories* mem);
void i8_store(memories* mem, uint8_t val, uint32_t idx) {
mem->memorytwo.data[idx] = val;
return;
}
uint8_t i8_load(memories* mem, uint32_t idx) {
return mem->memorytwo.data[idx];
}
int start(memories* mem) {
i8_store(mem, 42, 8);
return i8_load(mem, 8);
}
```
`main.cc`
```c++
#include <stdint.h>
typedef struct {
uint8_t* data;
uint32_t size;
} wasm_rt_memory_t;
typedef struct {
wasm_rt_memory_t memoryone;
wasm_rt_memory_t memorytwo;
} memories;
static memories global_mem;
int main() {
return start(&global_mem);
}
```
and the compiled assembly code:
```assembly
void i8_store(memories* mem, uint8_t val, uint32_t idx) {
mem->memorytwo.data[idx] = val;
0: 48 8b 47 10 mov 0x10(%rdi),%rax
4: 89 d1 mov %edx,%ecx
6: 40 88 34 08 mov %sil,(%rax,%rcx,1)
return;
a: c3 ret
b: 0f 1f 44 00 00 nopl 0x0(%rax,%rax,1)
```
There are also two memory access, ` 0: 48 8b 47 10 mov 0x10(%rdi),%rax` for getting `mem->memorytwo.data` and `6: 40 88 34 08 mov %sil,(%rax,%rcx,1)` for the actual store.
##
Both the status quo and our version of wasm2c has the same memory access overhead on the assembly code level. It would be nice if someone could share their thoughts on the memory access pattern of wasm2c and also the changes we are planning to make.
|
Thoughts on making wasm2c thread-safe
|
https://api.github.com/repos/WebAssembly/wabt/issues/1805/comments
| 4 |
2022-01-13T21:11:55Z
|
2022-04-14T23:28:59Z
|
https://github.com/WebAssembly/wabt/issues/1805
| 1,102,382,737 | 1,805 |
[
"WebAssembly",
"wabt"
] |
running `wasm-strip` 1.0.24 on one of our Rust-compiled, with SIMD enabled, WASM modules fails with:
```
0000a70: error: expected valid local type
```
and another similar one (repro binary: [opcode_fail_module.wasm.zip](https://github.com/WebAssembly/wabt/files/7854907/opcode_fail_module.wasm.zip)) fail with:
```
00005c7: error: unexpected opcode: 0xfd 0x0
```
have seen a few other variants also:
```
000060b: error: unexpected opcode: 0xfd 0xc
```
The same modules, when compiled without SIMD support in Rust for `wasm32-unknown-unknown` does work to strip. So was suspecting the latest `wasm-strip` release doesn't fully support SIMD instructions.
Maybe solved in later PRs that hasn't had a release yet?
Sounded potentially related to:
- #1617
|
wasm-strip fails on module with SIMD instructions
|
https://api.github.com/repos/WebAssembly/wabt/issues/1803/comments
| 2 |
2022-01-12T13:28:07Z
|
2022-04-27T04:41:45Z
|
https://github.com/WebAssembly/wabt/issues/1803
| 1,100,343,043 | 1,803 |
[
"WebAssembly",
"wabt"
] |
I have downloaded **wabt** in my Linux Mint machine, but when I try to use the **wat2wasm _file.wat_** command into a simple example like this, it gives me error.
```
(module
(func $add (param $lhs i32) (param $rhs i32) (result i32)
get_local $lhs
get_local $rhs
i32.add)
(export "add" (func $add))
)
```
This is the error:
```
add1.wat:3:5: error: unexpected token get_local, expected ).
get_local $lhs
^^^^^^^^^
add1.wat:4:5: error: unexpected token get_local.
get_local $rhs
```
The same code in the wat2wasm online demo works fine. When I use `wat2wasm --version` it says my version is 1.0.25.
Any ideas of why the _unexpected token get_local_ error appears? Thanks in advance.
|
wat2wasm gives error: unexpected token get_local
|
https://api.github.com/repos/WebAssembly/wabt/issues/1802/comments
| 6 |
2022-01-11T20:13:17Z
|
2022-09-05T07:52:55Z
|
https://github.com/WebAssembly/wabt/issues/1802
| 1,099,576,889 | 1,802 |
[
"WebAssembly",
"wabt"
] |
See https://github.com/WebAssembly/binaryen/issues/4418 for details. It looks like on imported functions wabt's name section emitting code will emit an empty name for params. That is, the empty string "". That seems like a bug to me as it is not useful for a debugger (the index would be better than the name).
|
Empty param name in name section for imported functions
|
https://api.github.com/repos/WebAssembly/wabt/issues/1799/comments
| 9 |
2022-01-06T21:23:34Z
|
2022-01-08T21:48:39Z
|
https://github.com/WebAssembly/wabt/issues/1799
| 1,095,706,985 | 1,799 |
[
"WebAssembly",
"wabt"
] |
In `SharedValidator::OnFuncType`, there is this code:
```
if (!options_.features.multi_value_enabled() && result_count > 1) {
result |=
PrintError(loc, "multiple result values not currently supported.");
}
```
WABT does indeed support multi-value, however.
Maybe the error message should say 'not currently enabled' when multi-value is disabled.
|
Wording of error message 'multiple result values not currently supported'
|
https://api.github.com/repos/WebAssembly/wabt/issues/1796/comments
| 2 |
2021-12-23T19:47:54Z
|
2022-01-10T15:59:46Z
|
https://github.com/WebAssembly/wabt/issues/1796
| 1,087,956,833 | 1,796 |
[
"WebAssembly",
"wabt"
] |
Describe the bug
A bug was found within the wabt. Though it might not be an intended use of the relevant API, the bug can still produce critical issues within a program using wabt. It would be best if the affected logic is checked beforehand.
The bug was found with a fuzzer based on the function "WastParser.LongTokenSpace".
This may cause problems in the use of libraries
This is potentially the cause of Out of Memory
I think Validation Check is needed to ensure safe code.
How To Reproduce
1. Download the attached file
2. Execute make_wabt_bug2.sh
3. wabt/build/wabt-unittests --gtest_filter=WastParser.LongTokenSpace
Platform (please complete the following information):
OS: Ubuntu 18.04
[wabt_bug2.tar.gz](https://github.com/WebAssembly/wabt/files/7766056/wabt_bug2.tar.gz)
|
Bug report on wabt( AddressSanitizer: OOM)
|
https://api.github.com/repos/WebAssembly/wabt/issues/1794/comments
| 0 |
2021-12-23T01:25:28Z
|
2022-09-18T05:13:37Z
|
https://github.com/WebAssembly/wabt/issues/1794
| 1,087,297,335 | 1,794 |
[
"WebAssembly",
"wabt"
] |
Describe the bug
A bug was found within the wabt. Though it might not be an intended use of the relevant API, the bug can still produce critical issues within a program using wabt. It would be best if the affected logic is checked beforehand.
The bug was found with a fuzzer based on the function "string_view.rfind2".
This may cause problems in the use of libraries
How To Reproduce
1. Download the attached file
2. Execute make_wabt_bug1.sh
3. wabt/build/wabt-unittests --gtest_filter=string_view.rfind2string_view.rfind2
==47462==ERROR: AddressSanitizer: SEGV on unknown address 0x001a401df790 (pc 0x000000acb859 bp 0x7ffcf6f85950 sp 0x7ffcf6f85900 T0)
==47462==The signal is caused by a READ memory access.
#0 0xacb859 in bool __gnu_cxx::__ops::_Iter_equals_iter<std::reverse_iterator<char const*> >::operator()<std::reverse_iterator<char const*> >(std::reverse_iterator<char const*>) /usr/lib/gcc/x86_64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/bits/predefined_ops.h:262:21
#1 0xacb287 in std::reverse_iterator<char const*> std::__find_if<std::reverse_iterator<char const*>, __gnu_cxx::__ops::_Iter_equals_iter<std::reverse_iterator<char const*> > >(std::reverse_iterator<char const*>, std::reverse_iterator<char const*>, __gnu_cxx::__ops::_Iter_equals_iter<std::reverse_iterator<char const*> >, std::random_access_iterator_tag) /usr/lib/gcc/x86_64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/bits/stl_algo.h:120:8
#2 0xacaced in std::reverse_iterator<char const*> std::__find_if<std::reverse_iterator<char const*>, __gnu_cxx::__ops::_Iter_equals_iter<std::reverse_iterator<char const*> > >(std::reverse_iterator<char const*>, std::reverse_iterator<char const*>, __gnu_cxx::__ops::_Iter_equals_iter<std::reverse_iterator<char const*> >) /usr/lib/gcc/x86_64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/bits/stl_algo.h:161:14
#3 0xaca7cb in std::reverse_iterator<char const*> std::__search<std::reverse_iterator<char const*>, std::reverse_iterator<char const*>, __gnu_cxx::__ops::_Iter_equal_to_iter>(std::reverse_iterator<char const*>, std::reverse_iterator<char const*>, std::reverse_iterator<char const*>, std::reverse_iterator<char const*>, __gnu_cxx::__ops::_Iter_equal_to_iter) /usr/lib/gcc/x86_64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/bits/stl_algo.h:226:6
#4 0xac6e40 in std::reverse_iterator<char const*> std::search<std::reverse_iterator<char const*>, std::reverse_iterator<char const*> >(std::reverse_iterator<char const*>, std::reverse_iterator<char const*>, std::reverse_iterator<char const*>, std::reverse_iterator<char const*>) /usr/lib/gcc/x86_64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/bits/stl_algo.h:4151:14
#5 0xac6a9d in wabt::string_view::rfind(wabt::string_view, unsigned long) const wabt/src/string-view.cc:127:27
#6 0xac73a8 in wabt::string_view::rfind(char const*, unsigned long, unsigned long) const wabt/src/string-view.cc:140:10
Platform (please complete the following information):
OS: Ubuntu 18.04
[wabt_bug1.tar.gz](https://github.com/WebAssembly/wabt/files/7766049/wabt_bug1.tar.gz)
|
Bug report on wabt( AddressSanitizer: SEGV)
|
https://api.github.com/repos/WebAssembly/wabt/issues/1793/comments
| 2 |
2021-12-23T01:22:31Z
|
2022-09-18T05:13:56Z
|
https://github.com/WebAssembly/wabt/issues/1793
| 1,087,296,349 | 1,793 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.