Skip to content

Commit be0db66

Browse files
committed
Squelch bminor/bash alerts and set query precision to high.
1 parent 9e600e3 commit be0db66

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ predicate isCompiledAsC(Function f) {
3434
from FunctionCall fc, Function f
3535
where
3636
f = fc.getTarget() and
37+
f.getNumberOfParameters() = 0 and
3738
not f.isVarargs() and
3839
hasZeroParamDecl(f) and
3940
isCompiledAsC(f) and

cpp/ql/test/query-tests/Likely Bugs/Underspecified Functions/test.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ void test(int *argv[]) {
3838

3939
int x;
4040
declared_empty_defined_with(&x); // BAD
41-
declared_empty_defined_with(3, &x); // BAD
41+
declared_empty_defined_with(3, &x); // BAD [NOT DETECTED]
4242

4343
not_declared_defined_with(-1, 0, 2U); // GOOD
4444
not_declared_defined_with(4LL, 0, 2.5e9f); // BAD
@@ -114,3 +114,13 @@ unsigned int defined_with_ptr_arr(unsigned int *ptr[]) {
114114
void declared_and_defined_empty() {
115115
return;
116116
}
117+
118+
extern int will_be_k_and_r();
119+
120+
int call_k_and_r(int i) {
121+
return will_be_k_and_r(i); // GOOD
122+
}
123+
124+
int will_be_k_and_r(val)
125+
int val;
126+
{ return val + 1; }

0 commit comments

Comments
 (0)