@@ -81,8 +81,7 @@ private void checkForSink(Abstraction d1, Abstraction source, Stmt stmt, final V
8181 if (aliasing .mayAlias (val , ap .getPlainValue ())) {
8282 SinkInfo sinkInfo = sourceSinkManager .getSinkInfo (stmt , getManager (), source .getAccessPath ());
8383 if (sinkInfo != null ) {
84- if (!getResults ().addResult (new AbstractionAtSink (sinkInfo .getDefinitions (), source , stmt )))
85- killState = true ;
84+ registerTaintResult (sinkInfo , new AbstractionAtSink (sinkInfo .getDefinitions (), source , stmt ));
8685 }
8786 }
8887 }
@@ -151,10 +150,8 @@ public Collection<Abstraction> propagateCallToReturnFlow(Abstraction d1, Abstrac
151150
152151 // If we have already seen the same taint at the same sink, there is no need to
153152 // propagate this taint any further.
154- if (sinkInfo != null
155- && !getResults ().addResult (new AbstractionAtSink (sinkInfo .getDefinitions (), source , stmt ))) {
156- killState = true ;
157- }
153+ if (sinkInfo != null )
154+ registerTaintResult (sinkInfo , new AbstractionAtSink (sinkInfo .getDefinitions (), source , stmt ));
158155 }
159156 }
160157 }
@@ -180,9 +177,8 @@ public Collection<Abstraction> propagateReturnFlow(Collection<Abstraction> calle
180177 if (matches && source .isAbstractionActive () && ssm != null && aliasing != null
181178 && aliasing .mayAlias (source .getAccessPath ().getPlainValue (), returnStmt .getOp ())) {
182179 SinkInfo sinkInfo = ssm .getSinkInfo (returnStmt , getManager (), source .getAccessPath ());
183- if (sinkInfo != null
184- && !getResults ().addResult (new AbstractionAtSink (sinkInfo .getDefinitions (), source , returnStmt )))
185- killState = true ;
180+ if (sinkInfo != null )
181+ registerTaintResult (sinkInfo , new AbstractionAtSink (sinkInfo .getDefinitions (), source , returnStmt ));
186182 }
187183 }
188184
@@ -193,4 +189,19 @@ public Collection<Abstraction> propagateReturnFlow(Collection<Abstraction> calle
193189 return null ;
194190 }
195191
192+ /**
193+ * Registers a taint result
194+ * @param sinkInfo information about the sink (must not be null)
195+ * @param abstractionAtSink the abstraction at sink (must not be null)
196+ */
197+ protected void registerTaintResult (SinkInfo sinkInfo , AbstractionAtSink abstractionAtSink ) {
198+ boolean continueDataFlow = getResults ().addResult (abstractionAtSink );
199+ if (!continueDataFlow )
200+ setKillState ();
201+ }
202+
203+ protected void setKillState () {
204+ killState = true ;
205+ }
206+
196207}
0 commit comments