mirror of
https://github.com/github/codeql.git
synced 2026-05-02 12:15:17 +02:00
C++: Recover some of the good results we lost
My recent changes to suppress FPs in `ReturnStackAllocatedMemory.ql` caused us to lose all results where there was a `Conversion` at the initial address escape. We cannot handle conversions in general, but this commit restores the good results for the trivial types of conversion that we can handle.
This commit is contained in:
@@ -6,4 +6,4 @@
|
||||
| test.cpp:112:2:112:12 | return ... | May return stack-allocated memory from $@. | test.cpp:112:9:112:11 | arr | arr |
|
||||
| test.cpp:119:2:119:19 | return ... | May return stack-allocated memory from $@. | test.cpp:119:11:119:13 | arr | arr |
|
||||
| test.cpp:149:3:149:22 | return ... | May return stack-allocated memory from $@. | test.cpp:149:11:149:21 | threadLocal | threadLocal |
|
||||
| test.cpp:190:3:190:14 | return ... | May return stack-allocated memory from $@. | test.cpp:188:13:188:19 | myLocal | myLocal |
|
||||
| test.cpp:171:3:171:24 | return ... | May return stack-allocated memory from $@. | test.cpp:170:35:170:41 | myLocal | myLocal |
|
||||
|
||||
@@ -168,7 +168,7 @@ char *returnAfterCopy() {
|
||||
void *conversionBeforeDataFlow() {
|
||||
int myLocal;
|
||||
void *pointerToLocal = (void *)&myLocal; // has conversion
|
||||
return pointerToLocal; // BAD [NOT DETECTED]
|
||||
return pointerToLocal; // BAD
|
||||
}
|
||||
|
||||
void *arrayConversionBeforeDataFlow() {
|
||||
@@ -187,5 +187,5 @@ int *&conversionInFlow() {
|
||||
int myLocal;
|
||||
int *p = &myLocal;
|
||||
int *&pRef = p; // has conversion in the middle of data flow
|
||||
return pRef; // BAD [MISLEADING ALERT MESSAGE]
|
||||
return pRef; // BAD [NOT DETECTED]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user