Skip to content

Commit f90bc0a

Browse files
committed
Merge branch 'develop' of github.com:secure-software-engineering/FlowDroid into develop
2 parents 8832988 + 18d145d commit f90bc0a

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

soot-infoflow/src/soot/jimple/infoflow/problems/BackwardsInfoflowProblem.java

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,10 @@ private Set<Abstraction> computeAliases(final DefinitionStmt defStmt, Value left
209209
ArrayRef arrayRef = (ArrayRef) leftValue;
210210
newType = TypeUtils.buildArrayOrAddDimension(newType, arrayRef.getType().getArrayType());
211211
} else if (defStmt.getRightOp() instanceof ArrayRef) {
212-
newType = ((ArrayType) newType).getElementType();
212+
if (newType instanceof ArrayType)
213+
newType = ((ArrayType) newType).getElementType();
214+
else
215+
newType = null;
213216
} else {
214217
// Type check
215218
if (!manager.getTypeUtils().checkCast(source.getAccessPath(), leftValue.getType()))
@@ -318,17 +321,19 @@ else if (defStmt.getRightOp() instanceof LengthExpr) {
318321
targetType = TypeUtils.buildArrayOrAddDimension(targetType,
319322
arrayRef.getType().getArrayType());
320323
} else if (leftValue instanceof ArrayRef) {
321-
assert source.getAccessPath().getBaseType() instanceof ArrayType;
322-
targetType = ((ArrayType) targetType).getElementType();
323-
324324
// If we have a type of java.lang.Object, we try
325325
// to tighten it
326326
if (TypeUtils.isObjectLikeType(targetType))
327327
targetType = rightValue.getType();
328+
else if (targetType instanceof ArrayType)
329+
targetType = ((ArrayType) targetType).getElementType();
330+
else
331+
targetType = null;
328332

329333
// If the types do not match, the right side
330334
// cannot be an alias
331-
if (!manager.getTypeUtils().checkCast(rightValue.getType(), targetType))
335+
if (targetType != null
336+
&& !manager.getTypeUtils().checkCast(rightValue.getType(), targetType))
332337
addRightValue = false;
333338
}
334339
}

soot-infoflow/src/soot/jimple/infoflow/problems/rules/ArrayPropagationRule.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,10 @@ && getAliasing().mayAlias(rightBase, source.getAccessPath().getPlainValue())) {
6969
// We must remove one layer of array typing, e.g., A[][] -> A[]
7070
Type targetType = source.getAccessPath().getBaseType();
7171
assert targetType instanceof ArrayType;
72-
targetType = ((ArrayType) targetType).getElementType();
72+
if (targetType instanceof ArrayType)
73+
targetType = ((ArrayType) targetType).getElementType();
74+
else
75+
targetType = null;
7376

7477
// Create the new taint abstraction
7578
ArrayTaintType arrayTaintType = source.getAccessPath().getArrayTaintType();

0 commit comments

Comments
 (0)