21
21
import boomerang .scene .AnalysisScope ;
22
22
import boomerang .scene .ControlFlowGraph .Edge ;
23
23
import boomerang .scene .Val ;
24
+ import boomerang .scene .jimple .JimpleStatement ;
24
25
import boomerang .scene .jimple .SootCallGraph ;
25
26
import boomerang .util .AccessPath ;
26
27
import de .fraunhofer .iem .secucheck .analysis .Analysis ;
36
37
import de .fraunhofer .iem .secucheck .analysis .result .TaintFlowQueryResult ;
37
38
import soot .Body ;
38
39
import soot .SootMethod ;
40
+ import soot .jimple .IdentityStmt ;
39
41
import soot .jimple .JimpleBody ;
42
+ import soot .jimple .ParameterRef ;
40
43
import soot .jimple .internal .JNopStmt ;
41
44
import wpds .impl .Weight ;
42
45
import wpds .impl .Weight .NoWeight ;
@@ -211,11 +214,24 @@ private SameTypedPair<LocationDetails> getLocationDetailsPair(TaintFlowQueryImpl
211
214
startDetails .setSourceClassName (start .cfgEdge ().getMethod ().getDeclaringClass ().getName ());
212
215
startDetails .setMethodSignature (start .cfgEdge ().getMethod ().getSubSignature ());
213
216
214
- // TODO: Confirm that the destination is always Y.
215
- startDetails .setUsageStartLineNumber (start .cfgEdge ().getY ().getStartLineNumber ());
216
- startDetails .setUsageEndLineNumber (start .cfgEdge ().getY ().getEndLineNumber ());
217
- startDetails .setUsageStartColumnNumber (start .cfgEdge ().getY ().getStartColumnNumber ());
218
- startDetails .setUsageEndColumnNumber (start .cfgEdge ().getY ().getEndColumnNumber ());
217
+ // When parameter is tainted.
218
+ // Left and Right Op() methods don't work for IdentityStmt inside JimpleStatement.
219
+ if (start .cfgEdge ().getY ().isIdentityStmt () && start .cfgEdge ().getY () instanceof JimpleStatement ) {
220
+ JimpleStatement jimpleStament = (JimpleStatement ) start .cfgEdge ().getY ();
221
+ IdentityStmt identityStmt = (IdentityStmt )jimpleStament .getDelegate ();
222
+ if (identityStmt .getRightOp () instanceof ParameterRef ) {
223
+ SootMethod sootMethod = Utility .getSootMethod (start .cfgEdge ().getY ().getMethod ());
224
+ startDetails .setUsageStartLineNumber (sootMethod .getJavaSourceStartLineNumber ());
225
+ startDetails .setUsageEndLineNumber (-1 );
226
+ startDetails .setUsageStartColumnNumber (sootMethod .getJavaSourceStartColumnNumber ());
227
+ startDetails .setUsageEndColumnNumber (-1 );
228
+ }
229
+ } else {
230
+ startDetails .setUsageStartLineNumber (start .cfgEdge ().getY ().getStartLineNumber ());
231
+ startDetails .setUsageEndLineNumber (start .cfgEdge ().getY ().getEndLineNumber ());
232
+ startDetails .setUsageStartColumnNumber (start .cfgEdge ().getY ().getStartColumnNumber ());
233
+ startDetails .setUsageEndColumnNumber (start .cfgEdge ().getY ().getEndColumnNumber ());
234
+ }
219
235
220
236
startDetails .setUsageMethodSignature (start .cfgEdge ().getY ().getMethod ().getSubSignature ());
221
237
startDetails .setUsageClassName (start .cfgEdge ().getY ().getMethod ().getDeclaringClass ().getName ());
@@ -224,8 +240,7 @@ private SameTypedPair<LocationDetails> getLocationDetailsPair(TaintFlowQueryImpl
224
240
LocationDetails endDetails = new LocationDetails ();
225
241
endDetails .setSourceClassName (end .cfgEdge ().getMethod ().getDeclaringClass ().getName ());
226
242
endDetails .setMethodSignature (end .cfgEdge ().getMethod ().getSubSignature ());
227
-
228
- // TODO: Confirm that the destination is always Y.
243
+
229
244
endDetails .setUsageStartLineNumber (end .cfgEdge ().getY ().getStartLineNumber ());
230
245
endDetails .setUsageEndLineNumber (end .cfgEdge ().getY ().getEndLineNumber ());
231
246
endDetails .setUsageStartColumnNumber (end .cfgEdge ().getY ().getStartColumnNumber ());
0 commit comments