Skip to content

Commit 0914161

Browse files
committed
Removing 'const' specifier filtering after discussions with the team. We will test if this causes undesirable cases in DCA and then choose which approach is best.
1 parent d4bc2ce commit 0914161

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ predicate isNonConst(DataFlow::Node node) {
6565
or
6666
// Parameters of uncalled functions that aren't const
6767
exists(UncalledFunction f, Parameter p |
68-
not hasConstSpecifier(p.getType()) and
68+
//not hasConstSpecifier(p.getType()) and
6969
f.getAParameter() = p and
7070
p = node.asParameter()
7171
)
@@ -78,11 +78,13 @@ predicate isNonConst(DataFlow::Node node) {
7878
// The function's output must also not be const to be considered a non-const source
7979
exists(Call c |
8080
exists(Expr arg | c.getAnArgument() = arg |
81-
arg = node.asDefiningArgument() and
82-
not hasConstSpecifier(arg.getType())
81+
arg = node.asDefiningArgument()
82+
// and
83+
// not hasConstSpecifier(arg.getType())
8384
)
8485
or
85-
c = node.asIndirectExpr() and not hasConstSpecifier(c.getType())
86+
c = node.asIndirectExpr()
87+
// and not hasConstSpecifier(c.getType())
8688
) and
8789
not exists(Function func, FunctionInput input, FunctionOutput output, CallInstruction call |
8890
// NOTE: we must include dataflow and taintflow. e.g., including only dataflow we will find sprintf

0 commit comments

Comments
 (0)