wat2wasm segfaults on .wat file with many nested if statements
envgap__WebAssembly__wabt-2377
01 / FAILURE SIGNATURE
As reported upstream
No identifying execution failure has been captured.
Not a benchmark task.
- The project already builds and runs before the fix, so there is nothing to repair.
02 / ENVIRONMENT RECIPE
- Base commit
9dfd98d113408b7ad95336d1395f04fbd60f8997- Manifest
CMakeLists.txt- Reproduce
Awaiting issue-specific recipe- Run under trace
Awaiting a meaningful runtime command
03 / ORIGINAL ISSUE TEXT
WebAssembly/wabt #2377 · read the original issue
Running `wat2wasm` on a rather big file with many nested if-statements segfaults.
Version: wabt 1.0.32-1 (debian bookworm)
System: Debian (with enough RAM + swap)
Steps to reproduce:
```
wasm2wat CertiCoq.Benchmarks.tests.color.wasm > color.wat // color.wat is ~20GB
wat2wasm color.wat -o color.wam // Segmention fault
wasm-tools parse color.wat -o color.wasm // works
```
segfault:
```
(gdb) run
Starting program: /home/wolfgang/ProjectsUni/Compilerstep/wabt/out/clang/Debug/wat2wasm color.wat -o color.wasm
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Program received signal SIGSEGV, Segmentation fault.
0x00005555555f3db3 in wabt::WastParser::GetToken (this=0x7fffffffd800)
at /home/wolfgang/ProjectsUni/Compilerstep/wabt/src/wast-parser.cc:585
585 if (tokens_.empty()) {
(gdb)
```
[CertiCoq.Benchmarks.tests.color.zip](https://github.com/WebAssembly/wabt/files/14104533/CertiCoq.Benchmarks.tests.color.zip)
04 / LABELS
Labels from the report text only; not yet run
No supported category has been assigned.
Label rules and the text that matched
[]