mirror of
https://github.com/github/codeql.git
synced 2026-05-05 21:55:19 +02:00
Merge pull request #10496 from aeisenberg/aeisenberg/merge-rc3.7-into-main
Aeisenberg/merge rc3.7 into main
This commit is contained in:
@@ -64,6 +64,10 @@ edges
|
||||
| test.cpp:201:5:201:17 | EnterFunction: maybe_deref_p | test.cpp:201:5:201:17 | VariableAddress: maybe_deref_p |
|
||||
| test.cpp:210:3:210:9 | Call: call to escape1 | test.cpp:201:5:201:17 | EnterFunction: maybe_deref_p |
|
||||
| test.cpp:210:3:210:9 | Call: call to escape1 | test.cpp:201:5:201:17 | VariableAddress: maybe_deref_p |
|
||||
| test.cpp:234:3:234:13 | Store: ... = ... | test.cpp:238:3:238:9 | Call: call to escape2 |
|
||||
| test.cpp:238:3:238:9 | Call: call to escape2 | test.cpp:239:17:239:17 | Load: p |
|
||||
| test.cpp:263:3:263:13 | Store: ... = ... | test.cpp:267:3:267:9 | Call: call to escape3 |
|
||||
| test.cpp:267:3:267:9 | Call: call to escape3 | test.cpp:268:17:268:17 | Load: p |
|
||||
#select
|
||||
| test.cpp:15:16:15:16 | Load: p | test.cpp:10:3:10:13 | Store: ... = ... | test.cpp:15:16:15:16 | Load: p | Stack variable $@ escapes $@ and is used after it has expired. | test.cpp:9:7:9:7 | x | x | test.cpp:10:3:10:13 | Store: ... = ... | here |
|
||||
| test.cpp:24:16:24:16 | Load: p | test.cpp:10:3:10:13 | Store: ... = ... | test.cpp:24:16:24:16 | Load: p | Stack variable $@ escapes $@ and is used after it has expired. | test.cpp:9:7:9:7 | x | x | test.cpp:10:3:10:13 | Store: ... = ... | here |
|
||||
@@ -90,3 +94,5 @@ edges
|
||||
| test.cpp:180:14:180:19 | Load: * ... | test.cpp:154:3:154:22 | Store: ... = ... | test.cpp:180:14:180:19 | Load: * ... | Stack variable $@ escapes $@ and is used after it has expired. | test.cpp:133:7:133:8 | b2 | b2 | test.cpp:154:3:154:22 | Store: ... = ... | here |
|
||||
| test.cpp:181:13:181:20 | Load: access to array | test.cpp:155:3:155:21 | Store: ... = ... | test.cpp:181:13:181:20 | Load: access to array | Stack variable $@ escapes $@ and is used after it has expired. | test.cpp:134:7:134:8 | b3 | b3 | test.cpp:155:3:155:21 | Store: ... = ... | here |
|
||||
| test.cpp:182:14:182:19 | Load: * ... | test.cpp:156:3:156:25 | Store: ... = ... | test.cpp:182:14:182:19 | Load: * ... | Stack variable $@ escapes $@ and is used after it has expired. | test.cpp:134:7:134:8 | b3 | b3 | test.cpp:156:3:156:25 | Store: ... = ... | here |
|
||||
| test.cpp:239:17:239:17 | Load: p | test.cpp:234:3:234:13 | Store: ... = ... | test.cpp:239:17:239:17 | Load: p | Stack variable $@ escapes $@ and is used after it has expired. | test.cpp:232:7:232:7 | x | x | test.cpp:234:3:234:13 | Store: ... = ... | here |
|
||||
| test.cpp:268:17:268:17 | Load: p | test.cpp:263:3:263:13 | Store: ... = ... | test.cpp:268:17:268:17 | Load: p | Stack variable $@ escapes $@ and is used after it has expired. | test.cpp:260:7:260:7 | x | x | test.cpp:263:3:263:13 | Store: ... = ... | here |
|
||||
|
||||
@@ -209,4 +209,61 @@ int maybe_deref_p(bool b) {
|
||||
int field_indirect_maybe_bad(bool b) {
|
||||
escape1();
|
||||
return maybe_deref_p(b);
|
||||
}
|
||||
|
||||
// These next tests cover subsequent stores to the same address in the same basic block.
|
||||
|
||||
static struct S100 s102;
|
||||
|
||||
void not_escape1() {
|
||||
int x;
|
||||
s102.p = &x;
|
||||
s102.p = nullptr;
|
||||
}
|
||||
|
||||
void calls_not_escape1() {
|
||||
not_escape1();
|
||||
int x = *s102.p; // GOOD
|
||||
}
|
||||
|
||||
static struct S100 s103;
|
||||
|
||||
void escape2() {
|
||||
int x;
|
||||
s103.p = nullptr;
|
||||
s103.p = &x;
|
||||
}
|
||||
|
||||
void calls_escape2() {
|
||||
escape2();
|
||||
int x = *s103.p; // BAD
|
||||
}
|
||||
|
||||
bool unknown();
|
||||
static struct S100 s104;
|
||||
|
||||
void not_escape2() {
|
||||
int x;
|
||||
s104.p = &x;
|
||||
if(unknown()) { }
|
||||
s104.p = nullptr;
|
||||
}
|
||||
|
||||
void calls_not_escape2() {
|
||||
not_escape2();
|
||||
int x = *s104.p; // GOOD
|
||||
}
|
||||
|
||||
static struct S100 s105;
|
||||
|
||||
void escape3() {
|
||||
int x;
|
||||
s105.p = nullptr;
|
||||
if(unknown()) { }
|
||||
s105.p = &x;
|
||||
}
|
||||
|
||||
void calls_escape3() {
|
||||
escape3();
|
||||
int x = *s105.p; // BAD
|
||||
}
|
||||
Reference in New Issue
Block a user