joern icon indicating copy to clipboard operation
joern copied to clipboard

[Question]How does Joern know if a function can call to another function?

Open duhang1996 opened this issue 1 year ago • 7 comments

duhang1996 avatar Jul 20 '23 06:07 duhang1996

why the result is empty? image

duhang1996 avatar Jul 20 '23 07:07 duhang1996

why the result is empty? image

because the sink is the method, not the call. Try to swap them

ycclnn avatar Jul 20 '23 08:07 ycclnn

the result is as the same image

duhang1996 avatar Jul 21 '23 08:07 duhang1996

the result is as the same image

@yzn12345 Do you know why?

duhang1996 avatar Jul 24 '23 06:07 duhang1996

@prabhu could you help?

duhang1996 avatar Jul 25 '23 03:07 duhang1996

@duhang1996, I don't see any code snippet but in general the granularity of reachability detection is at the method parameter or call argument level.

So you can do

def source=cpg.method.parameter
def sink=cpg.call.argument

sink.reachableByFlows(source).p

prabhu avatar Jul 25 '23 10:07 prabhu

reachableByFlows only for data flow analysis, in your case, you should use caller or callee to find your call path.

scanleale avatar Oct 17 '23 08:10 scanleale