@@ -164,20 +164,6 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
164164 module Impl< FullStateConfigSig Config> {
165165 private class FlowState = Config:: FlowState ;
166166
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-
181167 private module SourceSinkFiltering {
182168 private import codeql.util.AlertFiltering
183169
@@ -1043,10 +1029,15 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
10431029 bindingset [ label1, label2]
10441030 pragma [ inline_late]
10451031 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
10501041 }
10511042
10521043 pragma [ nomagic]
@@ -2819,15 +2810,15 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
28192810 pragma [ nomagic]
28202811 PathNodeImpl getAnImplicitReadSuccessorAtSink ( string label ) {
28212812 exists ( PathNodeMid readTarget |
2822- result = this .getASuccessorImpl ( label ) and
2813+ result = this .getASuccessorImpl ( _ ) and
28232814 localStep ( this , readTarget , _) and
28242815 readTarget .getNodeEx ( ) .isImplicitReadNode ( _)
28252816 |
28262817 // last implicit read, leaving the access path empty
2827- result = readTarget .projectToSink ( _ )
2818+ result = readTarget .projectToSink ( label )
28282819 or
28292820 // implicit read, leaving the access path non-empty
2830- exists ( result .getAnImplicitReadSuccessorAtSink ( _ ) ) and
2821+ exists ( result .getAnImplicitReadSuccessorAtSink ( label ) ) and
28312822 result = readTarget
28322823 )
28332824 }
@@ -2859,7 +2850,7 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
28592850 // `x [Field]` -> `x`
28602851 //
28612852 // which the restriction below ensures.
2862- not result = this .getAnImplicitReadSuccessorAtSink ( label )
2853+ not result = this .getAnImplicitReadSuccessorAtSink ( _ )
28632854 or
28642855 exists ( string l1 , string l2 |
28652856 result = this .getASuccessorFromNonHidden ( l1 ) .getASuccessorIfHidden ( l2 ) and
@@ -2980,18 +2971,15 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
29802971 )
29812972 or
29822973 // 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 )
29862976 |
29872977 not this .isSourceWithLabel ( _) and
2988- if sinkmodel != "" then label = l2_ + "Sink:" + sinkmodel else label = l2
2978+ label = mergeLabels ( l2 , sinkLabel )
29892979 or
29902980 exists ( string l1 |
29912981 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 )
29952983 )
29962984 )
29972985 }
@@ -3057,11 +3045,14 @@ module MakeImpl<LocationSig Location, InputSig<Location> Lang> {
30573045 else any ( )
30583046 }
30593047
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+ )
30653056 }
30663057 }
30673058
0 commit comments