Skip to content

Commit 0e100af

Browse files
authored
Merge branch 'main' into rb/diff-informed
2 parents c9d17cc + d5571c5 commit 0e100af

File tree

6 files changed

+26
-3
lines changed

6 files changed

+26
-3
lines changed

cpp/ql/src/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
### Minor Analysis Improvements
88

9-
* The "Call to function with fewer arguments than declared parameters" query (`cpp/too-few-arguments`) query no longer produces results if the function has been implicitly declared.
9+
* The "Call to function with fewer arguments than declared parameters" query (`cpp/too-few-arguments`) no longer produces results if the function has been implicitly declared.
1010

1111
## 1.2.7
1212

cpp/ql/src/Likely Bugs/Memory Management/ReturnStackAllocatedMemory.ql

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,8 @@ class ReturnStackAllocatedMemoryConfig extends MustFlowConfiguration {
9292
or
9393
node2.(PointerOffsetInstruction).getLeftOperand() = node1
9494
}
95+
96+
override predicate isBarrier(Instruction n) { n.getResultType() instanceof ErroneousType }
9597
}
9698

9799
from
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
category: minorAnalysis
3+
---
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/src/change-notes/released/1.3.0.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@
66

77
### Minor Analysis Improvements
88

9-
* The "Call to function with fewer arguments than declared parameters" query (`cpp/too-few-arguments`) query no longer produces results if the function has been implicitly declared.
9+
* The "Call to function with fewer arguments than declared parameters" query (`cpp/too-few-arguments`) no longer produces results if the function has been implicitly declared.

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,4 +248,5 @@ char* test_strdupa(const char* s) {
248248
void* test_strndupa(const char* s, size_t size) {
249249
char* s2 = strndupa(s, size);
250250
return s2; // BAD
251-
}
251+
}
252+
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; // BAD [FALSE NEGATIVE]
11+
}
12+
13+
int* test_error_pointer_member() {
14+
UNKNOWN_TYPE x;
15+
return &x.y; // BAD [FALSE NEGATIVE]
16+
}

0 commit comments

Comments
 (0)