Skip to content

Commit 5cae652

Browse files
committed
CPP: Fix FPs from AV Rule 114.ql.
1 parent d18a701 commit 5cae652

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

cpp/ql/src/jsf/4.13 Functions/AV Rule 114.ql

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ predicate functionImperfectlyExtracted(Function f) {
3838
exists(CompilerError e | f.getBlock().getLocation().subsumes(e.getLocation()))
3939
or
4040
exists(ErrorExpr ee | ee.getEnclosingFunction() = f)
41+
or
42+
count(f.getType()) > 1
4143
}
4244

4345
from Stmt stmt, string msg, Function f, ControlFlowNode blame

cpp/ql/test/query-tests/jsf/4.13 Functions/AV Rule 114/AV Rule 114.expected

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
| test.c:8:5:8:14 | declaration | Function f2 should return a value of type int but does not return a value here |
22
| test.c:25:9:25:14 | ExprStmt | Function f4 should return a value of type int but does not return a value here |
33
| test.c:39:9:39:14 | ExprStmt | Function f6 should return a value of type int but does not return a value here |
4-
| test.c:95:2:95:20 | if (...) ... | Function f13_func should return a value of type int but does not return a value here |
5-
| test.c:95:2:95:20 | if (...) ... | Function f13_func should return a value of type void but does not return a value here |
64
| test.cpp:16:1:18:1 | { ... } | Function g2 should return a value of type MyValue but does not return a value here |
75
| test.cpp:48:2:48:26 | if (...) ... | Function g7 should return a value of type MyValue but does not return a value here |
86
| test.cpp:74:1:76:1 | { ... } | Function g10 should return a value of type second but does not return a value here |

cpp/ql/test/query-tests/jsf/4.13 Functions/AV Rule 114/test.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,5 +92,5 @@ void f13()
9292

9393
void f13_func(int x)
9494
{
95-
if (x < 10) return; // GOOD [FALSE POSITIVE]
95+
if (x < 10) return; // GOOD
9696
}

0 commit comments

Comments
 (0)