Merge branch 'pull-request__android-bugfixes' of https://github.com/joana-team/WALA
This commit is contained in:
commit
a1dd19b8d0
|
@ -139,7 +139,7 @@ public abstract class SSAPropagationCallGraphBuilder extends PropagationCallGrap
|
|||
*
|
||||
* Doesn't play well with pre-transitive solver; turning off for now.
|
||||
*/
|
||||
protected final static boolean SHORT_CIRCUIT_SINGLE_USES = true;
|
||||
protected final static boolean SHORT_CIRCUIT_SINGLE_USES = false;
|
||||
|
||||
/**
|
||||
* Should we change calls to clone() to assignments?
|
||||
|
|
|
@ -651,6 +651,12 @@ public class DexIMethod implements IBytecodeMethod {
|
|||
endInst = getInstructionIndex(endAddress) - 1;
|
||||
}
|
||||
|
||||
for (int i = startInst; i <= endInst; i++) {
|
||||
//add the rest of the handlers
|
||||
for (EncodedTypeAddrPair etaps: tryItem.encodedCatchHandler.handlers) {
|
||||
temp_array.get(i).add(new ExceptionHandler( getInstructionIndex(etaps.getHandlerAddress()), etaps.exceptionType.getTypeDescriptor() ));
|
||||
}
|
||||
}
|
||||
//add the catch all handler if it exists
|
||||
int catchAllAddress = tryItem.encodedCatchHandler.getCatchAllHandlerAddress();
|
||||
if (catchAllAddress != -1) {
|
||||
|
@ -664,13 +670,6 @@ public class DexIMethod implements IBytecodeMethod {
|
|||
}
|
||||
//throw new UnimplementedError("DexIMethod->handlers: getCatchAllHandlerAddress() not yet implemented");
|
||||
}
|
||||
|
||||
for (int i = startInst; i <= endInst; i++) {
|
||||
//add the rest of the handlers
|
||||
for (EncodedTypeAddrPair etaps: tryItem.encodedCatchHandler.handlers) {
|
||||
temp_array.get(i).add(new ExceptionHandler( getInstructionIndex(etaps.getHandlerAddress()), etaps.exceptionType.getTypeDescriptor() ));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -583,7 +583,10 @@ public class AndroidModel /* makes SummarizedMethod */
|
|||
*/
|
||||
public SummarizedMethod getMethodAs(MethodReference asMethod, TypeReference caller,
|
||||
IntentStarters.StartInfo info, CGNode callerNd) throws CancelException {
|
||||
Set<StarterFlags> flags = info.getFlags();
|
||||
Set<StarterFlags> flags = null;
|
||||
if (info != null) {
|
||||
flags = info.getFlags();
|
||||
}
|
||||
//System.out.println("\n\nAS: " + asMethod + "\n\n");
|
||||
if (!built) {
|
||||
getMethod();
|
||||
|
|
|
@ -44,6 +44,9 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.ibm.wala.classLoader.CallSiteReference;
|
||||
import com.ibm.wala.classLoader.IClass;
|
||||
import com.ibm.wala.dalvik.ipa.callgraph.androidModel.AndroidModelClass;
|
||||
|
@ -78,7 +81,9 @@ import com.ibm.wala.util.strings.Atom;
|
|||
* @since 2013-10-22
|
||||
*/
|
||||
public class AndroidStartComponentTool {
|
||||
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(AndroidStartComponentTool.class);
|
||||
|
||||
private final IClassHierarchy cha;
|
||||
// private final MethodReference asMethod;
|
||||
private final Set<StarterFlags> flags;
|
||||
|
@ -307,7 +312,8 @@ public class AndroidStartComponentTool {
|
|||
|
||||
return androidContext;
|
||||
} else {
|
||||
throw new UnsupportedOperationException("Can not handle the callers android-context of " + caller);
|
||||
logger.debug("Can not handle the callers android-context of " + caller);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -117,7 +117,7 @@ public class IntentContextInterpreter implements SSAContextInterpreter {
|
|||
return intent.getComponent();
|
||||
} else if (intent.getType() == Intent.IntentType.SYSTEM_SERVICE) {
|
||||
|
||||
return null;
|
||||
return AndroidComponent.UNKNOWN;
|
||||
} else {
|
||||
final Set<AndroidComponent> possibleTargets = intentStarters.getInfo(method.getReference()).getComponentsPossible();
|
||||
if (possibleTargets.size() == 1) {
|
||||
|
@ -262,13 +262,6 @@ public class IntentContextInterpreter implements SSAContextInterpreter {
|
|||
throw new IllegalArgumentException("node is null");
|
||||
}
|
||||
final MethodReference target = node.getMethod().getReference();
|
||||
|
||||
{ // DEBUG
|
||||
if (target.toString().contains("getSystemService")) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
intentStarters.isStarter(target)
|
||||
);
|
||||
|
|
|
@ -350,7 +350,7 @@ public class DexSSABuilder extends AbstractIntRegisterMachine {
|
|||
public SymbolicPropagator(DexCFG dexCFG, SSAInstruction[] instructions, SSA2LocalMap localMap,
|
||||
SSACFG cfg, SSAPiNodePolicy piNodePolicy) {
|
||||
super(dexCFG);
|
||||
this.piNodePolicy = null;// piNodePolicy;
|
||||
this.piNodePolicy = piNodePolicy;
|
||||
this.cfg = cfg;
|
||||
this.creators = new SSAInstruction[0];
|
||||
this.dexCFG = dexCFG;
|
||||
|
|
|
@ -239,6 +239,7 @@ public enum AndroidComponent {
|
|||
* @return the corresponding Enum-Element or AndroidComponent.UNKNOWN
|
||||
*/
|
||||
public static AndroidComponent from(final IMethod method, final IClassHierarchy cha) {
|
||||
if (method == null) return AndroidComponent.UNKNOWN;
|
||||
IClass type = method.getDeclaringClass();
|
||||
|
||||
if (type == null) {
|
||||
|
|
|
@ -370,7 +370,7 @@ nextMethod:
|
|||
if (eps.add(ep)) {
|
||||
logger.debug("Heuristic 2b: selecting {}", method);
|
||||
}}
|
||||
} else {
|
||||
} else if (method != null) {
|
||||
// The function is taken from the super-class
|
||||
if (this.flags.contains(LocatorFlags.WITH_SUPER)) {
|
||||
final AndroidEntryPoint ep = makeEntryPointForHeuristic(method, cha);
|
||||
|
|
|
@ -167,7 +167,7 @@ public class AndroidManifestXMLReader {
|
|||
new ISubTags() { public Set<Tag> getSubTags() {
|
||||
return EnumSet.of(Tag.INTENT); }},
|
||||
EnumSet.of(Attr.ENABLED, Attr.TARGET, Attr.NAME),
|
||||
null),
|
||||
ComponentItem.class),
|
||||
SERVICE("service",
|
||||
new ISubTags() { public Set<Tag> getSubTags() {
|
||||
return EnumSet.of(Tag.INTENT); }},
|
||||
|
@ -591,9 +591,14 @@ public class AndroidManifestXMLReader {
|
|||
}
|
||||
}
|
||||
} else {
|
||||
throw new IllegalStateException("Error in parser implementation! The required attribute 'name' which should have been " +
|
||||
"defined in ACTION could not be retrieved. This should have been thrown before as it is a required attribute for " +
|
||||
"ACTION");
|
||||
/**
|
||||
* Previously, an exception was thrown but in fact there is no need to crash here.
|
||||
* Actions are required, but if there is no action in a particular intent-filter,
|
||||
* then no intent will pass the intent filter.
|
||||
* See also http://developer.android.com/guide/topics/manifest/action-element.html
|
||||
* So we'll just issue a warning and continue happily with our work...
|
||||
*/
|
||||
logger.warn("specified intent without action - this means that no intents will pass the filter...");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -611,6 +616,8 @@ public class AndroidManifestXMLReader {
|
|||
Tag current = parserStack.pop();
|
||||
if (allowedTags.contains(current)) {
|
||||
if (current == Tag.INTENT) {
|
||||
// do not expect item at top of stack if no intent was produced
|
||||
if (attributesHistory.get(Tag.INTENT).isEmpty()) continue;
|
||||
Object oIntent = attributesHistory.get(Tag.INTENT).peek();
|
||||
if (oIntent == null) {
|
||||
throw new IllegalStateException("The currently parsed Intent did not push a Valid intent to the " +
|
||||
|
@ -638,14 +645,24 @@ public class AndroidManifestXMLReader {
|
|||
logger.warn("Empty Package {}", attributesHistory.get(Attr.PACKAGE).peek());
|
||||
pack = null;
|
||||
}
|
||||
final String name = (String) attributesHistory.get(Attr.NAME).peek(); // TODO: Verify type!
|
||||
|
||||
final String name;
|
||||
if (self == Tag.ALIAS) {
|
||||
name = (String) attributesHistory.get(Attr.TARGET).peek(); // TODO: Verify type!
|
||||
} else {
|
||||
name = (String) attributesHistory.get(Attr.NAME).peek(); // TODO: Verify type!
|
||||
}
|
||||
final Intent intent = AndroidSettingFactory.intent(pack, name, null);
|
||||
|
||||
logger.info("\tRegister: {}", intent);
|
||||
AndroidEntryPointManager.MANAGER.registerIntent(intent);
|
||||
for (Intent ovr: overrideTargets) {
|
||||
logger.info("\tOverride: {} --> {}", ovr, intent);
|
||||
AndroidEntryPointManager.MANAGER.setOverride(ovr, intent);
|
||||
if (ovr.equals(intent)) {
|
||||
AndroidEntryPointManager.MANAGER.registerIntent(intent);
|
||||
} else {
|
||||
AndroidEntryPointManager.MANAGER.setOverride(ovr, intent);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -152,10 +152,9 @@ public class AndroidSettingFactory {
|
|||
name = pack + name;
|
||||
type = Intent.IntentType.INTERNAL_TARGET; // TODO Ehhh...
|
||||
} else if (!(name.contains("."))) {
|
||||
if ((pack == null) || (pack.isEmpty())) {
|
||||
throw new IllegalArgumentException("The pack is needed to resolve the full name of " + name + ", but it's empty");
|
||||
if ((pack != null) && (!pack.isEmpty())) {
|
||||
name = pack + "." + name;
|
||||
}
|
||||
name = pack + "." + name;
|
||||
type = Intent.IntentType.INTERNAL_TARGET; // TODO Ehhh...
|
||||
} else if ((pack != null) && (name.startsWith(pack))) {
|
||||
type = Intent.IntentType.INTERNAL_TARGET; // TODO Ehhh...
|
||||
|
@ -202,10 +201,16 @@ public class AndroidSettingFactory {
|
|||
//
|
||||
public static Intent intent(String fullyQualifiedAction, String uri) {
|
||||
if (fullyQualifiedAction.startsWith(".")) {
|
||||
throw new IllegalArgumentException("The action " + fullyQualifiedAction + " is not fully qualified! Use " +
|
||||
String pack = AndroidEntryPointManager.MANAGER.getPackage();
|
||||
if (pack != null) {
|
||||
return intent(pack, fullyQualifiedAction, uri);
|
||||
} else {
|
||||
throw new IllegalArgumentException("The action " + fullyQualifiedAction + " is not fully qualified and the application package is unknown! Use " +
|
||||
" intent(String pack, String name, String uri) to build the intent!");
|
||||
}
|
||||
} else {
|
||||
return intent(null, fullyQualifiedAction, uri);
|
||||
}
|
||||
return intent(null, fullyQualifiedAction, uri);
|
||||
}
|
||||
|
||||
public static Intent intent(String fullyQualifiedAction) {
|
||||
|
|
|
@ -175,7 +175,7 @@ public final class ActivityEP {
|
|||
public static final AndroidPossibleEntryPoint onStop = new AndroidPossibleEntryPoint(AndroidComponent.ACTIVITY,
|
||||
"onStop",
|
||||
ExecutionOrder.after(
|
||||
ExecutionOrder.AFTER_LOOP
|
||||
ExecutionOrder.END_OF_LOOP
|
||||
));
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue