зеркало из https://github.com/github/codeql.git
C#: Address review comments.
This commit is contained in:
Родитель
55cfbccd43
Коммит
e9c9519d90
|
@ -1149,7 +1149,7 @@ private module Cached {
|
|||
} or
|
||||
TCapturedVariableContent(VariableCapture::CapturedVariable v) or
|
||||
TDelegateCallArgumentContent(int i) {
|
||||
i = [0 .. max(int j | j = any(DelegateCall dc).getNumberOfArguments())]
|
||||
i = [0 .. max(any(DelegateCall dc).getNumberOfArguments())]
|
||||
} or
|
||||
TDelegateCallReturnContent()
|
||||
|
||||
|
@ -2287,10 +2287,10 @@ private predicate recordProperty(RecordType t, ContentSet c, string name) {
|
|||
* If there is a delegate call f(x), then we store "x" on "f"
|
||||
* using a delegate argument content set.
|
||||
*/
|
||||
private predicate storeStepDelegateCall(Node node1, ContentSet c, Node node2) {
|
||||
exists(DelegateCall call, int i |
|
||||
node1.asExpr() = call.getArgument(i) and
|
||||
node2.(PostUpdateNode).getPreUpdateNode().asExpr() = call.getExpr() and
|
||||
private predicate storeStepDelegateCall(ExplicitArgumentNode node1, ContentSet c, Node node2) {
|
||||
exists(ExplicitDelegateLikeDataFlowCall call, int i |
|
||||
node1.argumentOf(call, TPositionalArgumentPosition(i)) and
|
||||
lambdaCall(call, _, node2.(PostUpdateNode).getPreUpdateNode()) and
|
||||
c.isDelegateCallArgument(i)
|
||||
)
|
||||
}
|
||||
|
@ -2456,10 +2456,10 @@ private predicate readContentStep(Node node1, Content c, Node node2) {
|
|||
* If there is a delegate call f(x), then we read the return of the delegate
|
||||
* call.
|
||||
*/
|
||||
private predicate readStepDelegateCall(Node node1, ContentSet c, Node node2) {
|
||||
exists(DelegateCall call |
|
||||
node1.asExpr() = call.getExpr() and
|
||||
node2.asExpr() = call and
|
||||
private predicate readStepDelegateCall(Node node1, ContentSet c, OutNode node2) {
|
||||
exists(ExplicitDelegateLikeDataFlowCall call |
|
||||
lambdaCall(call, _, node1) and
|
||||
node2.getCall(TNormalReturnKind()) = call and
|
||||
c.isDelegateCallReturn()
|
||||
)
|
||||
}
|
||||
|
|
|
@ -64,10 +64,10 @@ public class BasicFlow
|
|||
}
|
||||
|
||||
public Func<object, object> MyFunction;
|
||||
// summary=Models;BasicFlow;false;MapMyFunction;(System.Object);;Argument[0];Argument[this];taint;df-generated
|
||||
// summary=Models;BasicFlow;false;MapMyFunction;(System.Object);;Argument[this];ReturnValue;taint;df-generated
|
||||
// summary=Models;BasicFlow;false;ApplyMyFunction;(System.Object);;Argument[0];Argument[this];taint;df-generated
|
||||
// summary=Models;BasicFlow;false;ApplyMyFunction;(System.Object);;Argument[this];ReturnValue;taint;df-generated
|
||||
// No content based flow as MaD doesn't support callback logic in fields and properties.
|
||||
public object MapMyFunction(object o)
|
||||
public object ApplyMyFunction(object o)
|
||||
{
|
||||
return MyFunction(o);
|
||||
}
|
||||
|
@ -517,18 +517,18 @@ public class HigherOrderParameters
|
|||
return s;
|
||||
}
|
||||
|
||||
// neutral=Models;HigherOrderParameters;Map;(System.Func<System.Object,System.Object>,System.Object);summary;df-generated
|
||||
// contentbased-summary=Models;HigherOrderParameters;false;Map;(System.Func<System.Object,System.Object>,System.Object);;Argument[1];Argument[0].Parameter[0];value;dfc-generated
|
||||
// contentbased-summary=Models;HigherOrderParameters;false;Map;(System.Func<System.Object,System.Object>,System.Object);;Argument[0].ReturnValue;ReturnValue;value;dfc-generated
|
||||
public object Map(Func<object, object> f, object o)
|
||||
// neutral=Models;HigherOrderParameters;Apply;(System.Func<System.Object,System.Object>,System.Object);summary;df-generated
|
||||
// contentbased-summary=Models;HigherOrderParameters;false;Apply;(System.Func<System.Object,System.Object>,System.Object);;Argument[1];Argument[0].Parameter[0];value;dfc-generated
|
||||
// contentbased-summary=Models;HigherOrderParameters;false;Apply;(System.Func<System.Object,System.Object>,System.Object);;Argument[0].ReturnValue;ReturnValue;value;dfc-generated
|
||||
public object Apply(Func<object, object> f, object o)
|
||||
{
|
||||
return f(o);
|
||||
}
|
||||
|
||||
// neutral=Models;HigherOrderParameters;Map2;(System.Object,System.Func<System.Object,System.Object,System.Object>);summary;df-generated
|
||||
// contentbased-summary=Models;HigherOrderParameters;false;Map2;(System.Object,System.Func<System.Object,System.Object,System.Object>);;Argument[0];Argument[1].Parameter[1];value;dfc-generated
|
||||
// contentbased-summary=Models;HigherOrderParameters;false;Map2;(System.Object,System.Func<System.Object,System.Object,System.Object>);;Argument[1].ReturnValue;ReturnValue;value;dfc-generated
|
||||
public object Map2(object o, Func<object, object, object> f)
|
||||
// neutral=Models;HigherOrderParameters;Apply2;(System.Object,System.Func<System.Object,System.Object,System.Object>);summary;df-generated
|
||||
// contentbased-summary=Models;HigherOrderParameters;false;Apply2;(System.Object,System.Func<System.Object,System.Object,System.Object>);;Argument[0];Argument[1].Parameter[1];value;dfc-generated
|
||||
// contentbased-summary=Models;HigherOrderParameters;false;Apply2;(System.Object,System.Func<System.Object,System.Object,System.Object>);;Argument[1].ReturnValue;ReturnValue;value;dfc-generated
|
||||
public object Apply2(object o, Func<object, object, object> f)
|
||||
{
|
||||
var x = f(null, o);
|
||||
return x;
|
||||
|
|
|
@ -631,7 +631,11 @@ module MakeModelGenerator<
|
|||
}
|
||||
|
||||
/**
|
||||
* Models as Data currently doesn't support callback logic in fields.
|
||||
* Holds if the access path `ap` is not a parameter or returnvalue of a callback
|
||||
* stored in a field.
|
||||
*
|
||||
* That is, we currently don't include summaries that rely on parameters or return values
|
||||
* of callbacks stored in fields.
|
||||
*/
|
||||
private predicate validateAccessPath(PropagateContentFlow::AccessPath ap) {
|
||||
not (mentionsField(ap) and mentionsCallback(ap))
|
||||
|
|
Загрузка…
Ссылка в новой задаче