From a2809c96595407a30f176ee60abba89773a4ac2a Mon Sep 17 00:00:00 2001 From: Marc Miltenberger Date: Sat, 28 Sep 2024 08:00:09 +0200 Subject: [PATCH 1/2] Make castPrimitive overridable by subclasses --- src/main/java/soot/toDex/ExprVisitor.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/soot/toDex/ExprVisitor.java b/src/main/java/soot/toDex/ExprVisitor.java index fade954d23b..2960b7b70ff 100644 --- a/src/main/java/soot/toDex/ExprVisitor.java +++ b/src/main/java/soot/toDex/ExprVisitor.java @@ -702,7 +702,7 @@ protected void castObject(Register sourceReg, Type castType) { } } - private void castPrimitive(Register sourceReg, Value source, Type castSootType) { + protected void castPrimitive(Register sourceReg, Value source, Type castSootType) { PrimitiveType castType = PrimitiveType.getByName(castSootType.toString()); // Fix null_types on the fly. This should not be necessary, but better From 96d4a909a77ec8a6c86e1060dae97c76f4d1d640 Mon Sep 17 00:00:00 2001 From: Marc Miltenberger Date: Sat, 28 Sep 2024 08:33:20 +0200 Subject: [PATCH 2/2] Allow subclasses to filter dex files --- src/main/java/soot/dexpler/DexFileProvider.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main/java/soot/dexpler/DexFileProvider.java b/src/main/java/soot/dexpler/DexFileProvider.java index 190a99ea58b..9e04924f6b9 100644 --- a/src/main/java/soot/dexpler/DexFileProvider.java +++ b/src/main/java/soot/dexpler/DexFileProvider.java @@ -230,6 +230,10 @@ private Map> mappingForFile(File dexSour while (entryNameIterator.hasPrevious()) { String entryName = entryNameIterator.previous(); DexEntry entry = dexContainer.getEntry(entryName); + if (!acceptFile(entry)) { + continue; + } + entryName = deriveDexName(entryName); logger.debug("" + String.format("Found dex file '%s' with %d classes in '%s'", entryName, entry.getDexFile().getClasses().size(), dexSourceFile.getCanonicalPath())); @@ -249,6 +253,10 @@ private Map> mappingForFile(File dexSour return Collections.unmodifiableMap(dexMap); } + protected boolean acceptFile(DexEntry entry) { + return true; + } + private String deriveDexName(String entryName) { return new File(entryName).getName(); }