python-idb icon indicating copy to clipboard operation
python-idb copied to clipboard

api.idaapi.FlowChart infinite loop

Open talangcc opened this issue 5 years ago • 3 comments

I want to get all basicblocks of all functions, so I use the api.idaapi.FlowChart(func_t) in my code. I find that sometimes it never ends when the binary is a bit large, so I debug it. I find that when it encounter a basic block including the instruction "jmp func_name", it will continue exploring the function func_name and the situation is also appeared in a single function thunk located at ".plt" section. How can I stop exploring further when it encouter the instruction "jmp func_name" or is there any other ways to get all basicblocks of all functions?

talangcc avatar Jun 29 '19 07:06 talangcc

hey @talangcc thanks for reporting this issue.

to make sure i understand the issue, is the problem that: when computing the control flow graph, the algorithm traverses nodes and does not stop when reaching another function via tail jmp/thunk?

can you provide references to any binaries that show this behavior? this will make it easier to develop a fix.

williballenthin avatar Jul 02 '19 15:07 williballenthin

Sorry, I made a mistake in the title, it should be api.idaapi.FlowChart. The situation happened when it call a function use jmp instruction like this(0x53c04c): 0x53c04c jmp sub_53a630 and sub_53a630 is a function. When I use the api.idaapi.FlowChart in this function, it will exploring the function sub_56a630, and it seems never end. image gvim.zip

talangcc avatar Jul 06 '19 07:07 talangcc

I have a question,is that how can you get func_t by python-idb?? Did you use the function idaapi.get_func(),but when i use it, it has an error ,showed that the api.idaapi.get_func() is wrong.'idaapi' object has no attribute 'get_func'

sezangel avatar May 31 '20 03:05 sezangel