Skip to content
Merged
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
7 changes: 6 additions & 1 deletion cpp/ql/src/semmle/code/cpp/security/FunctionWithWrappers.qll
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,14 @@ import PrintfLike
private import TaintTracking

private
bindingset[index]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using bindingset makes the function inline, which can make it harder to predict how it'll be optimised in future contexts. Do these unnamed parameters at least have a Parameter object? Then you should be able to add exists(func.getParameter(index)) after the or and remove the bindingset annotation.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried that and I didn't get the same results (and the test fails). I believe getParameter had no results.

Because this predicate is private, any non-local performance effects due to inlining should be localized to within this library.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

string toCause(Function func, int index)
{
result = func.getQualifiedName() + "(" + func.getParameter(index).getName() + ")"
result = func.getQualifiedName() + "(" + func.getParameter(index).getName() + ")" or
(
not exists(func.getParameter(index).getName()) and
result = func.getQualifiedName() + "(arg " + index + ")"
)
}

/**
Expand Down