mirror of
https://github.com/github/codeql.git
synced 2026-04-24 16:25:15 +02:00
C++: Add more cpp/invalid-pointer-deref FPs
This commit is contained in:
@@ -772,6 +772,19 @@ edges
|
||||
| test.cpp:393:9:393:10 | xs | test.cpp:395:5:395:13 | Store: ... = ... |
|
||||
| test.cpp:393:9:393:10 | xs | test.cpp:395:5:395:13 | Store: ... = ... |
|
||||
| test.cpp:395:5:395:6 | xs | test.cpp:395:5:395:13 | Store: ... = ... |
|
||||
| test.cpp:404:3:404:25 | ... = ... | test.cpp:404:7:404:8 | val indirection [post update] [xs] |
|
||||
| test.cpp:404:7:404:8 | val indirection [post update] [xs] | test.cpp:407:3:407:5 | val indirection [xs] |
|
||||
| test.cpp:404:12:404:25 | new[] | test.cpp:404:3:404:25 | ... = ... |
|
||||
| test.cpp:406:3:406:25 | ... = ... | test.cpp:406:7:406:8 | val indirection [post update] [xs] |
|
||||
| test.cpp:406:7:406:8 | val indirection [post update] [xs] | test.cpp:407:3:407:5 | val indirection [xs] |
|
||||
| test.cpp:406:12:406:25 | new[] | test.cpp:406:3:406:25 | ... = ... |
|
||||
| test.cpp:407:3:407:5 | val indirection [xs] | test.cpp:407:7:407:8 | xs indirection |
|
||||
| test.cpp:407:3:407:18 | access to array | test.cpp:407:3:407:22 | Store: ... = ... |
|
||||
| test.cpp:407:7:407:8 | xs | test.cpp:407:3:407:18 | access to array |
|
||||
| test.cpp:407:7:407:8 | xs indirection | test.cpp:407:7:407:8 | xs |
|
||||
| test.cpp:417:16:417:33 | new[] | test.cpp:419:7:419:8 | xs |
|
||||
| test.cpp:419:7:419:8 | xs | test.cpp:419:7:419:11 | access to array |
|
||||
| test.cpp:419:7:419:11 | access to array | test.cpp:419:7:419:15 | Store: ... = ... |
|
||||
nodes
|
||||
| test.cpp:4:15:4:20 | call to malloc | semmle.label | call to malloc |
|
||||
| test.cpp:5:15:5:15 | p | semmle.label | p |
|
||||
@@ -1122,6 +1135,21 @@ nodes
|
||||
| test.cpp:393:9:393:10 | xs | semmle.label | xs |
|
||||
| test.cpp:395:5:395:6 | xs | semmle.label | xs |
|
||||
| test.cpp:395:5:395:13 | Store: ... = ... | semmle.label | Store: ... = ... |
|
||||
| test.cpp:404:3:404:25 | ... = ... | semmle.label | ... = ... |
|
||||
| test.cpp:404:7:404:8 | val indirection [post update] [xs] | semmle.label | val indirection [post update] [xs] |
|
||||
| test.cpp:404:12:404:25 | new[] | semmle.label | new[] |
|
||||
| test.cpp:406:3:406:25 | ... = ... | semmle.label | ... = ... |
|
||||
| test.cpp:406:7:406:8 | val indirection [post update] [xs] | semmle.label | val indirection [post update] [xs] |
|
||||
| test.cpp:406:12:406:25 | new[] | semmle.label | new[] |
|
||||
| test.cpp:407:3:407:5 | val indirection [xs] | semmle.label | val indirection [xs] |
|
||||
| test.cpp:407:3:407:18 | access to array | semmle.label | access to array |
|
||||
| test.cpp:407:3:407:22 | Store: ... = ... | semmle.label | Store: ... = ... |
|
||||
| test.cpp:407:7:407:8 | xs | semmle.label | xs |
|
||||
| test.cpp:407:7:407:8 | xs indirection | semmle.label | xs indirection |
|
||||
| test.cpp:417:16:417:33 | new[] | semmle.label | new[] |
|
||||
| test.cpp:419:7:419:8 | xs | semmle.label | xs |
|
||||
| test.cpp:419:7:419:11 | access to array | semmle.label | access to array |
|
||||
| test.cpp:419:7:419:15 | Store: ... = ... | semmle.label | Store: ... = ... |
|
||||
subpaths
|
||||
#select
|
||||
| test.cpp:6:14:6:15 | Load: * ... | test.cpp:4:15:4:20 | call to malloc | test.cpp:6:14:6:15 | Load: * ... | This read might be out of bounds, as the pointer might be equal to $@ + $@. | test.cpp:4:15:4:20 | call to malloc | call to malloc | test.cpp:5:19:5:22 | size | size |
|
||||
@@ -1149,3 +1177,5 @@ subpaths
|
||||
| test.cpp:372:15:372:16 | Load: * ... | test.cpp:363:14:363:27 | new[] | test.cpp:372:15:372:16 | Load: * ... | This read might be out of bounds, as the pointer might be equal to $@ + $@. | test.cpp:363:14:363:27 | new[] | new[] | test.cpp:365:19:365:22 | size | size |
|
||||
| test.cpp:384:13:384:16 | Load: * ... | test.cpp:377:14:377:27 | new[] | test.cpp:384:13:384:16 | Load: * ... | This read might be out of bounds, as the pointer might be equal to $@ + $@. | test.cpp:377:14:377:27 | new[] | new[] | test.cpp:378:20:378:23 | size | size |
|
||||
| test.cpp:395:5:395:13 | Store: ... = ... | test.cpp:388:14:388:27 | new[] | test.cpp:395:5:395:13 | Store: ... = ... | This write might be out of bounds, as the pointer might be equal to $@ + $@. | test.cpp:388:14:388:27 | new[] | new[] | test.cpp:389:19:389:22 | size | size |
|
||||
| test.cpp:407:3:407:22 | Store: ... = ... | test.cpp:404:12:404:25 | new[] | test.cpp:407:3:407:22 | Store: ... = ... | This write might be out of bounds, as the pointer might be equal to $@ + $@. | test.cpp:404:12:404:25 | new[] | new[] | test.cpp:407:10:407:17 | ... - ... | ... - ... |
|
||||
| test.cpp:419:7:419:15 | Store: ... = ... | test.cpp:417:16:417:33 | new[] | test.cpp:419:7:419:15 | Store: ... = ... | This write might be out of bounds, as the pointer might be equal to $@ + $@. | test.cpp:417:16:417:33 | new[] | new[] | test.cpp:419:10:419:10 | i | i |
|
||||
|
||||
@@ -394,3 +394,30 @@ void test28(unsigned size) {
|
||||
return;
|
||||
xs[0] = 0; // GOOD [FALSE POSITIVE]
|
||||
}
|
||||
|
||||
struct test29_struct {
|
||||
char* xs;
|
||||
};
|
||||
|
||||
void test29(unsigned size) {
|
||||
test29_struct val;
|
||||
val.xs = new char[size];
|
||||
size++;
|
||||
val.xs = new char[size];
|
||||
val.xs[size - 1] = 0; // GOOD [FALSE POSITIVE]
|
||||
}
|
||||
|
||||
void test30(int *size)
|
||||
{
|
||||
int new_size = 0, tmp_size = 0;
|
||||
|
||||
test30(&tmp_size);
|
||||
if (tmp_size + 1 > new_size) {
|
||||
new_size = tmp_size + 1;
|
||||
char *xs = new char[new_size];
|
||||
for (int i = 0; i < new_size; i++) {
|
||||
xs[i] = 0; // GOOD [FALSE POSITIVE]
|
||||
}
|
||||
}
|
||||
*size = new_size;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user