Skip to content

Commit 02c69a7

Browse files
committed
CPP: Fix false positive.
1 parent e1d31bf commit 02c69a7

File tree

3 files changed

+2
-2
lines changed

3 files changed

+2
-2
lines changed

cpp/ql/src/Likely Bugs/Conversion/ArrayArgSizeMismatch.ql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ where f = c.getTarget() and
1717
b = paramType.getArraySize() and
1818
argType.getBaseType().getSize() = paramType.getBaseType().getSize() and
1919
a < b and
20+
a > 0 and
2021
// filter out results for inconsistent declarations
2122
strictcount(f.getParameter(i).getType().getSize()) = 1
2223
select c.getArgument(i), "Array of size " + a +
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
11
| test.cpp:24:4:24:7 | arr3 | Array of size 3 passed to $@ which expects an array of size 4. | test.cpp:8:6:8:6 | g | g |
2-
| test.cpp:40:9:40:12 | data | Array of size 0 passed to $@ which expects an array of size 4. | test.cpp:9:6:9:6 | h | h |

cpp/ql/test/query-tests/Likely Bugs/Conversion/ArrayArgSizeMismatch/test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ void test(float f3[3], float f4[4], float f5[5], float *fp)
3737
ms = (myStruct *)malloc(sizeof(myStruct) + (4 * sizeof(float)));
3838
ms->num = 4;
3939
ms->data[0] = ms->data[1] = ms->data[2] = ms->data[3] = 0;
40-
h(ms->data); // GOOD [FALSE POSITIVE]
40+
h(ms->data); // GOOD
4141
}
4242

4343
{

0 commit comments

Comments
 (0)