swam
swam copied to clipboard
Getting issue while creating the CFG for few of Wasm modules
Hi @satabin,
While accessing the CFG for the attached Wasm modules getting the below mentioned error in the screenshot.
Please find the attached document which provides more information on the error and the position at which the error is caused in Swam. Issues_with_CFG_Swam (4) (2).pdf.
Also, please find the wasm modules for which the issue is data_issue.zip detected.
Note: Also wanted to inform that, the issue is caused after filtering all the Wasi methods and while creating the CFG for the methods which are not injected by wasi, but the actual methods of the WebAssembly modules.
Hi @tareq97 thanks for reporting this. I will investigate what could cause this.
Could you provide the code snippet causing this exception?
Hi @satabin ,
I was able to create the same issue with scala script present inside zip file attached at the function id = 5.
Let me know if this helps.
Hi @satabin ,
Please find below code snippets where the issue is found.
The issue in the script Found at this code snippet: https://github.com/tareq97/swam/blob/db1b9fc297c62d66d115143a0760fd0ab9f59f23/fibo_cfg.sc#L25
https://github.com/satabin/swam/blob/3d5d43410ffb174ca99e08693c1693bf5d71834c/core/src/swam/cfg/CFGBuilder.scala#L133
Issue found at the above line.
The size of the below-mentioned array and hashmap should be the same. But they are not same while trying to make the CFG for this data https://github.com/tareq97/swam/blob/origin/feature/opt-in/Largest_number_divisible_by_its_digits.wasm for the function id = 5.
Below mentioned is the printed size of array and hashmap.
This is finalArray size : 412 This is Hash map id2postorder size : 408