Skip to content

Commit 8ace9da

Browse files
committed
fixup dataflow path and formatting
1 parent 73d306c commit 8ace9da

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

cpp/ql/src/experimental/Likely Bugs/DerefNullResult.ql

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,23 @@
1212
*/
1313

1414
import cpp
15-
import semmle.code.cpp.dataflow.DataFlow
15+
import semmle.code.cpp.dataflow.new.DataFlow
1616

1717
from Function nuller, Parameter pd, FunctionCall fc, Variable v
1818
where
1919
mayReturnNull(nuller) and
2020
functionDereferences(pd.getFunction(), pd.getIndex()) and
21-
2221
// there is a function call which will deref parameter pd
2322
fc.getTarget() = pd.getFunction() and
2423
// the parameter pd comes from a variable v
25-
DataFlow::localFlow(DataFlow::exprNode(v.getAnAccess()), DataFlow::exprNode(fc.getArgument(pd.getIndex()))) and
24+
DataFlow::localFlow(DataFlow::exprNode(v.getAnAccess()),
25+
DataFlow::exprNode(fc.getArgument(pd.getIndex()))) and
2626
// this variable v was assigned by a call to the nuller function
2727
v.getAnAssignedValue() = nuller.getACallToThisFunction() and
2828
// this variable v is not accessed for an operation (check for NULLness)
29-
not exists (VariableAccess vc | vc.getTarget() = v and (vc.getParent() instanceof Operation or vc.getParent() instanceof IfStmt))
30-
31-
select fc, "This function call may deref $@ when it can be NULL from $@", v, v.getName(), nuller, nuller.getName()
29+
not exists(VariableAccess vc |
30+
vc.getTarget() = v and
31+
(vc.getParent() instanceof Operation or vc.getParent() instanceof IfStmt)
32+
)
33+
select fc, "This function call may deref $@ when it can be NULL from $@", v, v.getName(), nuller,
34+
nuller.getName()

0 commit comments

Comments
 (0)