Skip to content

Commit 63fe4fb

Browse files
author
Dave Bartolomeo
committed
C++: More general model for pointer flow
1 parent 078d252 commit 63fe4fb

File tree

1 file changed

+12
-1
lines changed
  • cpp/ql/src/semmle/code/cpp/models/interfaces

1 file changed

+12
-1
lines changed

cpp/ql/src/semmle/code/cpp/models/interfaces/Alias.qll

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,5 +50,16 @@ abstract class AliasFunction extends Function {
5050
/**
5151
* Holds if the function always returns the value of the parameter at the specified index.
5252
*/
53-
abstract predicate parameterIsAlwaysReturned(int index);
53+
predicate parameterIsAlwaysReturned(int index) { none() }
54+
55+
/**
56+
* Holds if the address passed in via `input` is always propagated to `output`.
57+
*/
58+
predicate hasAddressFlow(FunctionInput input, FunctionOutput output) {
59+
exists(int index |
60+
// By default, just use the old `parameterIsAlwaysReturned` predicate to detect flow from the
61+
// parameter to the return value.
62+
input.isParameter(index) and output.isReturnValue() and this.parameterIsAlwaysReturned(index)
63+
)
64+
}
5465
}

0 commit comments

Comments
 (0)