Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions change_notes/2025-01-09-return-reference.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- `M7-5-1`, `RULE-6-8-2` - `FunctionReturnAutomaticVarCondition.ql`, `ReturnReferenceOrPointerToAutomaticLocalVariable.ql`:
- Remove false positives for member and global variables reported under this rule.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ abstract class ReturnReferenceOrPointerToAutomaticLocalVariableSharedQuery exten
Query getQuery() { result instanceof ReturnReferenceOrPointerToAutomaticLocalVariableSharedQuery }

query predicate problems(
ReturnStmt rs, string message, Function f, string f_string, Variable auto, string auto_string
ReturnStmt rs, string message, Function f, string f_string, StackVariable auto, string auto_string
) {
exists(VariableAccess va, string returnType |
not isExcluded(rs, getQuery()) and
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,17 @@ void test_templatefunction_return() {
int j = 2;
int k = 3;
t1(j, k);
}

class C1 {
private:
int x;

public:
int test() { return x; } // COMPLIANT - ignore member vars
};

int x;
int test_global() {
return x; // COMPLIANT - ignore global vars
}
Loading