Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wasm-decompile decompile error #2475

Open
spencerwuwu opened this issue Sep 26, 2024 · 2 comments
Open

wasm-decompile decompile error #2475

spencerwuwu opened this issue Sep 26, 2024 · 2 comments

Comments

@spencerwuwu
Copy link

Hi wabt team,

Recently I have been testing the decompile tool chain of WebAssembly. This is conducted by comparing the results of a C program:

  • compile into WASM, decompile with wasm-decompile, rewrite syntax and re-compile into native binary.
  • directly compile into native binary.

A few execution discrepancies are discovered during this process.
One is as the displayed code snipped. It seems like the recovered data flow is incorrect.
image
image

May I ask if this is an implementation error, or am I missing anything here?

Attaching the files related to this report. 198.zip

  • 198.c: A C program generated with csmith. The goal is to compare the final hash value after executing func_1.
  • 198 is the compiled WASM
  • 198_wasm-decompile.c: Decompiled result by wasm-decompile.
  • 198_new.c: Extract the decompiled func_1 in 198_wasm-decompile.c and fix the syntax to make it re-compilable

Thank you

@sbc100
Copy link
Member

sbc100 commented Sep 26, 2024

Unfortunately we don't have anybody how has worked on or contributed to wasm-decompile in a long time. If you would like to improve it that would seems reasonable, or we could simple remove it.

Can I ask why you trying to do this kind of testing? If you want to compile your wasm program via C then we have the wasm2c tool which is actively maintained and used.

@spencerwuwu
Copy link
Author

Hi Sam, thank you for the fast response! I see.

This is a research project that I worked on, comparing different decompilers. Unfortunately I am not the WASM expert on our team to be able to contribute to it. Personally would love to this tool being here though, and hopefully someone someday improves it. The concept of having readable decompile code is reasonable.

wasm2c works like a charm btw.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants