@@ -164,20 +164,6 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
164
164
module Impl< FullStateConfigSig Config> {
165
165
private class FlowState = Config:: FlowState ;
166
166
167
- private class NodeEx extends NodeExImpl {
168
- NodeEx ( ) {
169
- Config:: allowImplicitRead ( any ( Node n | this .isImplicitReadNode ( n ) ) , _)
170
- or
171
- not this .isImplicitReadNode ( _)
172
- }
173
- }
174
-
175
- private class ArgNodeEx extends NodeEx , ArgNodeExImpl { }
176
-
177
- private class ParamNodeEx extends NodeEx , ParamNodeExImpl { }
178
-
179
- private class RetNodeEx extends NodeEx , RetNodeExImpl { }
180
-
181
167
private module SourceSinkFiltering {
182
168
private import codeql.util.AlertFiltering
183
169
@@ -1043,10 +1029,15 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
1043
1029
bindingset [ label1, label2]
1044
1030
pragma [ inline_late]
1045
1031
private string mergeLabels ( string label1 , string label2 ) {
1046
- // Big-step, hidden nodes, and summaries all may need to merge labels.
1047
- // These cases are expected to involve at most one non-empty label, so
1048
- // we'll just discard the 2nd+ label for now.
1049
- if label1 = "" then result = label2 else result = label1
1032
+ if label2 .matches ( "Sink:%" )
1033
+ then if label1 = "" then result = label2 else result = label1 + " " + label2
1034
+ else
1035
+ // Big-step, hidden nodes, and summaries all may need to merge labels.
1036
+ // These cases are expected to involve at most one non-empty label, so
1037
+ // we'll just discard the 2nd+ label for now.
1038
+ if label1 = ""
1039
+ then result = label2
1040
+ else result = label1
1050
1041
}
1051
1042
1052
1043
pragma [ nomagic]
@@ -2819,15 +2810,15 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
2819
2810
pragma [ nomagic]
2820
2811
PathNodeImpl getAnImplicitReadSuccessorAtSink ( string label ) {
2821
2812
exists ( PathNodeMid readTarget |
2822
- result = this .getASuccessorImpl ( label ) and
2813
+ result = this .getASuccessorImpl ( _ ) and
2823
2814
localStep ( this , readTarget , _) and
2824
2815
readTarget .getNodeEx ( ) .isImplicitReadNode ( _)
2825
2816
|
2826
2817
// last implicit read, leaving the access path empty
2827
- result = readTarget .projectToSink ( _ )
2818
+ result = readTarget .projectToSink ( label )
2828
2819
or
2829
2820
// implicit read, leaving the access path non-empty
2830
- exists ( result .getAnImplicitReadSuccessorAtSink ( _ ) ) and
2821
+ exists ( result .getAnImplicitReadSuccessorAtSink ( label ) ) and
2831
2822
result = readTarget
2832
2823
)
2833
2824
}
@@ -2859,7 +2850,7 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
2859
2850
// `x [Field]` -> `x`
2860
2851
//
2861
2852
// which the restriction below ensures.
2862
- not result = this .getAnImplicitReadSuccessorAtSink ( label )
2853
+ not result = this .getAnImplicitReadSuccessorAtSink ( _ )
2863
2854
or
2864
2855
exists ( string l1 , string l2 |
2865
2856
result = this .getASuccessorFromNonHidden ( l1 ) .getASuccessorIfHidden ( l2 ) and
@@ -2980,18 +2971,15 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
2980
2971
)
2981
2972
or
2982
2973
// a final step to a sink
2983
- exists ( string l2 , string sinkmodel , string l2_ |
2984
- result = this .getSuccMid ( l2 ) .projectToSink ( sinkmodel ) and
2985
- if l2 = "" then l2_ = l2 else l2_ = l2 + " "
2974
+ exists ( string l2 , string sinkLabel |
2975
+ result = this .getSuccMid ( l2 ) .projectToSink ( sinkLabel )
2986
2976
|
2987
2977
not this .isSourceWithLabel ( _) and
2988
- if sinkmodel != "" then label = l2_ + "Sink:" + sinkmodel else label = l2
2978
+ label = mergeLabels ( l2 , sinkLabel )
2989
2979
or
2990
2980
exists ( string l1 |
2991
2981
this .isSourceWithLabel ( l1 ) and
2992
- if sinkmodel != ""
2993
- then label = l1 + l2_ + "Sink:" + sinkmodel
2994
- else label = l1 + l2
2982
+ label = l1 + mergeLabels ( l2 , sinkLabel )
2995
2983
)
2996
2984
)
2997
2985
}
@@ -3057,11 +3045,14 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
3057
3045
else any ( )
3058
3046
}
3059
3047
3060
- PathNodeSink projectToSink ( string model ) {
3061
- this .isAtSink ( ) and
3062
- sinkModel ( node , model ) and
3063
- result .getNodeEx ( ) = this .toNormalSinkNodeEx ( ) and
3064
- result .getState ( ) = state
3048
+ PathNodeSink projectToSink ( string label ) {
3049
+ exists ( string model |
3050
+ this .isAtSink ( ) and
3051
+ sinkModel ( node , model ) and
3052
+ result .getNodeEx ( ) = this .toNormalSinkNodeEx ( ) and
3053
+ result .getState ( ) = state and
3054
+ if model != "" then label = "Sink:" + model else label = ""
3055
+ )
3065
3056
}
3066
3057
}
3067
3058
0 commit comments