JS: Propagate locally returned functions out of calls

This commit is contained in:
Asger Feldthaus
2020-06-12 10:07:37 +01:00
parent 6531db3cca
commit 4c536dde20
2 changed files with 11 additions and 1 deletions

View File

@@ -61,6 +61,17 @@ module CallGraph {
function = cls.getConstructor() and
cls.getAClassReference(t.continue()).flowsTo(result)
)
or
imprecision = 0 and
exists(DataFlow::FunctionNode outer |
result = getAFunctionReference(outer, 0, t.continue()).getAnInvocation() and
locallyReturnedFunction(outer, function)
)
}
cached
private predicate locallyReturnedFunction(DataFlow::FunctionNode outer, DataFlow::FunctionNode inner) {
inner.flowsTo(outer.getAReturn())
}
/**