swam icon indicating copy to clipboard operation
swam copied to clipboard

Getting issue while creating the CFG for few of Wasm modules

Open tareq97-zz opened this issue 4 years ago • 4 comments

Hi @satabin,

While accessing the CFG for the attached Wasm modules getting the below mentioned error in the screenshot.

cfg_issue

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.

tareq97-zz avatar Aug 10 '20 12:08 tareq97-zz

Hi @tareq97 thanks for reporting this. I will investigate what could cause this.

satabin avatar Aug 11 '20 16:08 satabin

Could you provide the code snippet causing this exception?

satabin avatar Aug 11 '20 16:08 satabin

issue_script.zip

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.

tareq97-zz avatar Aug 11 '20 18:08 tareq97-zz

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

tareq97-zz avatar Aug 13 '20 22:08 tareq97-zz