SMAT-Lab / Scalpel

Scalpel: The Python Static Analysis Framework
Apache License 2.0
277 stars 42 forks source link

modified Block.get_source() #95

Closed mzy0624 closed 1 year ago

mzy0624 commented 1 year ago

code src += (astor.to_source(statement)).split('\n')[0] + "\n" may cause bugs, because when statement is long(more than 1 line after being processed), astor.to_source(statement)).split('\n')[0] is incomplete. So I modified the function Block.get_source() in file Scalpel/scalpel/cfg/model.py

Jarvx commented 1 year ago

Hi Mzy, thanks for your PR. Can you please attach a code snippet here that can cause bugs so that I can confirm?

mzy0624 commented 1 year ago

Code

get_source

For example, after the function exampleFunction with a long definition is processed by CFGBuilder, the source code of each basic block is obtained through the get_source function. The printed function definition is only a part, and the rest is replaced by ..., but this will cause bugs in subsequent analysis.

Jarvx commented 1 year ago

Code

get_source

For example, after the function exampleFunction with a long definition is processed by CFGBuilder, the source code of each basic block is obtained through the get_source function. The printed function definition is only a part, and the rest is replaced by ..., but this will cause bugs in subsequent analysis.

Thanks for the help! I will do testing and consider accepting this PR>

mzy0624 commented 1 year ago

Code get_source For example, after the function exampleFunction with a long definition is processed by CFGBuilder, the source code of each basic block is obtained through the get_source function. The printed function definition is only a part, and the rest is replaced by ..., but this will cause bugs in subsequent analysis.

Thanks for the help! I will do testing and consider accepting this PR>

Thank you too!

Jarvx commented 1 year ago

Thank you for the PR!