Skip to content

Commit e8587d0

Browse files
committed
Removing comments and formatting.
1 parent 9577c35 commit e8587d0

File tree

1 file changed

+10
-24
lines changed

1 file changed

+10
-24
lines changed

cpp/ql/src/Likely Bugs/Format/NonConstantFormat.ql

Lines changed: 10 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -91,15 +91,16 @@ predicate isNonConst(DataFlow::Node node, boolean isIndirect) {
9191
)
9292
)
9393
or
94-
exists(UncalledFunction f, Parameter p| f.getAParameter() = p |
95-
p = e.(VariableAccess).getTarget())
96-
or
94+
exists(UncalledFunction f, Parameter p | f.getAParameter() = p |
95+
p = e.(VariableAccess).getTarget()
96+
)
97+
or
9798
node instanceof FlowSource
9899
or
99-
(
100-
node instanceof DataFlow::DefinitionByReferenceNode and
101-
not exists(FormattingFunctionCall fc | node.asDefiningArgument() = fc.getOutputArgument(_)) and
102-
not exists(Call c | c.getAnArgument() = node.asDefiningArgument() and c.getTarget().hasDefinition())
100+
node instanceof DataFlow::DefinitionByReferenceNode and
101+
not exists(FormattingFunctionCall fc | node.asDefiningArgument() = fc.getOutputArgument(_)) and
102+
not exists(Call c |
103+
c.getAnArgument() = node.asDefiningArgument() and c.getTarget().hasDefinition()
103104
)
104105
)
105106
or
@@ -121,15 +122,7 @@ predicate isSinkImpl(DataFlow::Node sink, Expr formatString) {
121122
}
122123

123124
module NonConstFlowConfig implements DataFlow::ConfigSig {
124-
predicate isSource(DataFlow::Node source) {
125-
// isNonConst(source)
126-
isNonConst(source,_)
127-
// exists(boolean isIndirect, Type t |
128-
// isNonConst(source, isIndirect) and
129-
// t = source.getType() and
130-
// not cannotContainString(t, isIndirect)
131-
// )
132-
}
125+
predicate isSource(DataFlow::Node source) { isNonConst(source, _) }
133126

134127
predicate isSink(DataFlow::Node sink) { isSinkImpl(sink, _) }
135128

@@ -138,17 +131,10 @@ module NonConstFlowConfig implements DataFlow::ConfigSig {
138131

139132
module NonConstFlow = TaintTracking::Global<NonConstFlowConfig>;
140133

141-
// import NonConstFlow::PathGraph
142-
143-
from
144-
FormattingFunctionCall call, Expr formatString, DataFlow::Node sink
145-
// ,NonConstFlow::PathNode src,
146-
// NonConstFlow::PathNode sink
134+
from FormattingFunctionCall call, Expr formatString, DataFlow::Node sink
147135
where
148136
call.getArgument(call.getFormatParameterIndex()) = formatString and
149-
//NonConstFlow::flowPath(src, sink) and
150137
NonConstFlow::flowTo(sink) and
151-
//isSinkImpl(sink.getNode(), formatString)
152138
isSinkImpl(sink, formatString)
153139
select formatString, //sink.getNode(), src, sink,
154140
"The format string argument to " + call.getTarget().getName() +

0 commit comments

Comments
 (0)