mirror of
https://github.com/github/codeql.git
synced 2026-05-01 19:55:15 +02:00
CPP: Fix false positive.
This commit is contained in:
@@ -17,6 +17,7 @@ where f = c.getTarget() and
|
||||
b = paramType.getArraySize() and
|
||||
argType.getBaseType().getSize() = paramType.getBaseType().getSize() and
|
||||
a < b and
|
||||
a > 0 and
|
||||
// filter out results for inconsistent declarations
|
||||
strictcount(f.getParameter(i).getType().getSize()) = 1
|
||||
select c.getArgument(i), "Array of size " + a +
|
||||
|
||||
@@ -1,2 +1 @@
|
||||
| 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 |
|
||||
| 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 |
|
||||
|
||||
@@ -37,7 +37,7 @@ void test(float f3[3], float f4[4], float f5[5], float *fp)
|
||||
ms = (myStruct *)malloc(sizeof(myStruct) + (4 * sizeof(float)));
|
||||
ms->num = 4;
|
||||
ms->data[0] = ms->data[1] = ms->data[2] = ms->data[3] = 0;
|
||||
h(ms->data); // GOOD [FALSE POSITIVE]
|
||||
h(ms->data); // GOOD
|
||||
}
|
||||
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user