Skip to content

Commit b3f4c68

Browse files
committed
C++: Remove the BMN filter from some queries, but reduce precision to medium
Remove the `not any(Compilation c).buildModeNone() and` clause from: cpp/wrong-type-format-argument cpp/comparison-with-wider-type cpp/integer-multiplication-cast-to-long cpp/implicit-function-declaration cpp/suspicious-add-sizeof but reduce their precision to `medium`.
1 parent d87e9ec commit b3f4c68

File tree

5 files changed

+5
-10
lines changed

5 files changed

+5
-10
lines changed

cpp/ql/src/Likely Bugs/Arithmetic/IntMultToLong.ql

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* @kind problem
66
* @problem.severity warning
77
* @security-severity 8.1
8-
* @precision high
8+
* @precision medium
99
* @id cpp/integer-multiplication-cast-to-long
1010
* @tags reliability
1111
* security
@@ -179,7 +179,6 @@ predicate overflows(MulExpr me, Type t) {
179179

180180
from MulExpr me, Type t1, Type t2
181181
where
182-
not any(Compilation c).buildModeNone() and
183182
t1 = me.getType().getUnderlyingType() and
184183
t2 = me.getConversion().getType().getUnderlyingType() and
185184
t1.getSize() < t2.getSize() and

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* @kind problem
66
* @problem.severity error
77
* @security-severity 7.5
8-
* @precision high
8+
* @precision medium
99
* @id cpp/wrong-type-format-argument
1010
* @tags reliability
1111
* correctness
@@ -154,7 +154,6 @@ int sizeof_IntType() { exists(IntType it | result = it.getSize()) }
154154

155155
from FormattingFunctionCall ffc, int n, Expr arg, Type expected, Type actual
156156
where
157-
not any(Compilation c).buildModeNone() and
158157
(
159158
formattingFunctionCallExpectedType(ffc, n, expected) and
160159
formattingFunctionCallActualType(ffc, n, arg, actual) and

cpp/ql/src/Likely Bugs/Underspecified Functions/ImplicitFunctionDeclaration.ql

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* may lead to unpredictable behavior.
66
* @kind problem
77
* @problem.severity warning
8-
* @precision high
8+
* @precision medium
99
* @id cpp/implicit-function-declaration
1010
* @tags correctness
1111
* maintainability
@@ -38,7 +38,6 @@ predicate isCompiledAsC(File f) {
3838

3939
from FunctionDeclarationEntry fdeIm, FunctionCall fc
4040
where
41-
not any(Compilation c).buildModeNone() and
4241
isCompiledAsC(fdeIm.getFile()) and
4342
not isFromMacroDefinition(fc) and
4443
fdeIm.isImplicit() and

cpp/ql/src/Security/CWE/CWE-190/ComparisonWithWiderType.ql

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* @kind problem
77
* @problem.severity warning
88
* @security-severity 7.8
9-
* @precision high
9+
* @precision medium
1010
* @tags reliability
1111
* security
1212
* external/cwe/cwe-190
@@ -51,7 +51,6 @@ int getComparisonSizeAdjustment(Expr e) {
5151

5252
from Loop l, RelationalOperation rel, VariableAccess small, Expr large
5353
where
54-
not any(Compilation c).buildModeNone() and
5554
small = rel.getLesserOperand() and
5655
large = rel.getGreaterOperand() and
5756
rel = l.getCondition().getAChild*() and

cpp/ql/src/Security/CWE/CWE-468/SuspiciousAddWithSizeof.ql

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* @kind problem
77
* @problem.severity warning
88
* @security-severity 8.8
9-
* @precision high
9+
* @precision medium
1010
* @id cpp/suspicious-add-sizeof
1111
* @tags security
1212
* external/cwe/cwe-468
@@ -24,7 +24,6 @@ private predicate isCharSzPtrExpr(Expr e) {
2424

2525
from Expr sizeofExpr, Expr e
2626
where
27-
not any(Compilation c).buildModeNone() and
2827
// If we see an addWithSizeof then we expect the type of
2928
// the pointer expression to be `char*` or `void*`. Otherwise it
3029
// is probably a mistake.

0 commit comments

Comments
 (0)