Skip to content

Commit e067ac9

Browse files
committed
C++: Address review comments
1 parent fabaceb commit e067ac9

File tree

3 files changed

+17
-5
lines changed

3 files changed

+17
-5
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
---
22
category: minorAnalysis
33
---
4-
* The "Returning stack-allocated memory" query (`cpp/return-stack-allocated-memory`) no longer produces results if there is an extraction error in the type of the function.
4+
* The "Returning stack-allocated memory" query (`cpp/return-stack-allocated-memory`) no longer produces results if there is an extraction error in the returned expression.

cpp/ql/test/query-tests/Likely Bugs/Memory Management/ReturnStackAllocatedMemory/test.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,3 @@ void* test_strndupa(const char* s, size_t size) {
250250
return s2; // BAD
251251
}
252252

253-
UNKNOWN_TYPE test_error_type() {
254-
UNKNOWN_TYPE x;
255-
return x; // GOOD: Don't report error types
256-
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// semmle-extractor-options: --expect_errors
2+
3+
UNKNOWN_TYPE test_error_value() {
4+
UNKNOWN_TYPE x;
5+
return x; // GOOD: Error return type
6+
}
7+
8+
void* test_error_pointer() {
9+
UNKNOWN_TYPE x;
10+
return &x; // GOOD: Don't know what &x means
11+
}
12+
13+
int* test_error_pointer_member() {
14+
UNKNOWN_TYPE x;
15+
return &x.y; // GOOD: Don't know what x.y means
16+
}

0 commit comments

Comments
 (0)