Incorrect data-flow when using methodReturn node
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Domain
- devtools, reverse-engineering
Research direction
Reproduce the C snippet and the Joern queries using methodReturn, ast.isReturn, and reachableByFlows. Compare how the two sink forms are handled in the data-flow implementation, using the reported false flow from x as the regression case. Done means the methodReturn query no longer reports that flow while the valid return analysis remains intact.
Written by the indexing model from the issue text.
Description
I was using the following snippet to run a test,
int main(int argc, char *argv[]) {
int *tmp = NULL;
int x = 2;
if (argc > 0) {
tmp = &argc;
}
return *tmp;
}
x has no influence on the return value here, but
joern> def src = cpg.identifier.name("x")
defined function src
joern> def sink = cpg.method.name("main").methodReturn
defined function sink
joern> sink.reachableByFlows(src).p
res7: List[String] = List(
"""__________________________________________________________
| tracked| lineNumber| method| file |
|=========================================================|
| x = 2 | 6 | main | /Users/jai/dump/ret/main.c |
| int | 4 | main | /Users/jai/dump/ret/main.c |
"""
)
Using <node>.ast.isReturn works correctly though,
joern> def src = cpg.method.name("main").parameter.order(1)
defined function src
joern> def sink = cpg.method.name("main").ast.isReturn
defined function sink
joern> sink.reachableByFlows(src).p
res22: List[String] = List()
- Dominant language
- Scala
- Stars
- 599
- Forks
- 84
- Avg merge
- 18h 29m
- Merged PRs (30d)
- 1
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from ShiftLeftSecurity/codepropertygraph
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
-
Difficulty 3/5 1-2 days Newbie friendliness 25/100
ShiftLeftSecurity/codepropertygraph#1760 · 3 comments ·
-
Difficulty 5/5 Over a week Newbie friendliness 20/100
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
ShiftLeftSecurity/codepropertygraph#1082 · 1 comment ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
All issues in ShiftLeftSecurity/codepropertygraph
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
ergoplatform/ergodocs#614 ·
-
area:ci enhancement requires-triage
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
apache/datafusion-comet#6078 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
-
[VL] madvise(WILLNEED) call fails in MmapFileStream because of wrong calculation of fetching length Openbug triage
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
chipsalliance/rocket-chip#3831 ·