Closed samuelchassot closed 1 year ago
This is indeed an important issue as cfg is a core component of the framework. Thanks for raising this test case, it will be given top priority.
Great! You're fast :) I am looking into the code, I'll open a PR if I can fix the bug!
This example works as intended:
"""
src = textwrap.dedent("""
def f():
x = 1
try:
a = open("a.txt", "r")
x = 2
a.close()
except IOError:
x = 3
except:
x = 4
finally:
y = 1
y += 6
return x + y
""")
(it is to keep track, I'm working on a fix)
Hi, First of all, thanks for sharing this framework, this offers great opportunities for Python static analysis :)
I am building a tool that uses the CFG part of Scalpel, and I think I found a bug. When extracting the CFG of a function containing a
try-catch-except-finally
block, the CFG does not take the code in the finally or after thetry-except
blocks into account.Here is an example showing the behaviour I am describing:
Running this code outputs this CFG as png:
As we can see, a block is missing after the 3 blocks of the
try-except
part. There is not other blocks in the CFG object, it does not seem to be a rendering bug.I am available for any missing information or to try out stuff :)
Thanks a lot!