Files
codeql/python/ql/test/library-tests/PointsTo/new/PointsToMissing.ql
Taus Brock-Nannestad f07a7bf8cf Python: Autoformat everything using qlformat.
Will need subsequent PRs fixing up test failures (due to deprecated
methods moving around), but other than that everything should be
straight-forward.
2020-07-07 15:43:52 +02:00

26 lines
717 B
Plaintext

import python
import Util
import semmle.python.pointsto.PointsTo
import semmle.python.objects.ObjectInternal
/* This test should return _no_ results. */
predicate relevant_node(ControlFlowNode n) {
exists(CallNode c |
c.getFunction().(NameNode).getId() = "check" and
n = c.getAnArg()
)
or
exists(Comment c, string filepath, int bl |
n.getNode().getScope().getLocation().hasLocationInfo(filepath, bl, _, _, _) and
c.getLocation().hasLocationInfo(filepath, bl, _, _, _) and
c.getText().matches("%check") and
not n.(NameNode).isStore()
)
}
from ControlFlowNode f
where
relevant_node(f) and
not PointsTo::pointsTo(f, _, _, _)
select locate(f.getLocation(), "abchlr"), f.toString()