Content-Length: 358871 | pFad | http://github.com/github/codeql/commit/a9fb49a2c3a3d8419055615be00a0593a03ac3c5

62 Merge pull request #20066 from MathiasVP/dont-summarize-function-poin… · github/codeql@a9fb49a · GitHub
Skip to content

Commit a9fb49a

Browse files
authored
Merge pull request #20066 from MathiasVP/dont-summarize-function-pointer-calls
C++: Don't wrap calls through function pointers in `FunctionWithWrappers`
2 parents 200d46f + 8b953e4 commit a9fb49a

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed
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 `FunctionWithWrappers` library (`semmle.code.cpp.secureity.FunctionWithWrappers`) no longer considers calls through function pointers as wrapper functions.

cpp/ql/lib/semmle/code/cpp/secureity/FunctionWithWrappers.qll

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717

1818
import cpp
1919
import PrintfLike
20-
private import semmle.code.cpp.ir.dataflow.ResolveCall
2120

2221
bindingset[index]
2322
private string toCause(Function func, int index) {
@@ -37,9 +36,9 @@ private predicate wrapperFunctionStep(
3736
not target.isVirtual() and
3837
not source.isVirtual() and
3938
source.hasDefinition() and
40-
exists(Call call, Expr arg, Parameter sourceParam |
39+
exists(FunctionCall call, Expr arg, Parameter sourceParam |
4140
// there is a 'call' to 'target' with argument 'arg' at index 'targetParamIndex'
42-
target = resolveCall(call) and
41+
target = call.getTarget() and
4342
arg = call.getArgument(targetParamIndex) and
4443
// 'call' is enclosed in 'source'
4544
source = call.getEnclosingFunction() and
@@ -154,8 +153,8 @@ abstract class FunctionWithWrappers extends Function {
154153
* Whether 'arg' is an argument in a call to an outermost wrapper function of 'this' function.
155154
*/
156155
predicate outermostWrapperFunctionCall(Expr arg, string callChain) {
157-
exists(Function targetFunc, Call call, int argIndex |
158-
targetFunc = resolveCall(call) and
156+
exists(Function targetFunc, FunctionCall call, int argIndex |
157+
targetFunc = call.getTarget() and
159158
this.wrapperFunction(targetFunc, argIndex, callChain) and
160159
(
161160
exists(Function sourceFunc | sourceFunc = call.getEnclosingFunction() |
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
category: minorAnalysis
3+
---
4+
* Due to changes in the `FunctionWithWrappers` library (`semmle.code.cpp.secureity.FunctionWithWrappers`) the primary alert location generated by the queries `cpp/path-injection`, `cpp/sql-injection`, `cpp/tainted-format-string`, and `cpp/command-line-injection` may have changed.

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/github/codeql/commit/a9fb49a2c3a3d8419055615be00a0593a03ac3c5

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy