From 6c110c1d96a12e9517aefda64a3b32f437fcca0a Mon Sep 17 00:00:00 2001 From: Ben Gruver Date: Thu, 1 Aug 2019 14:40:07 -0700 Subject: [PATCH] Allow '!' as a separator char in embedded dex file names Newer versions of art seem to use ! instead of : to separate the inner dex filename from the name of the container containing it. e.g. /system/framework/framework.jar!classes2.dex instead of /system/framework/framework.jar:classes2.dex --- dexlib2/src/main/java/org/jf/dexlib2/DexFileFactory.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/dexlib2/src/main/java/org/jf/dexlib2/DexFileFactory.java b/dexlib2/src/main/java/org/jf/dexlib2/DexFileFactory.java index a4855c77..e19eb528 100644 --- a/dexlib2/src/main/java/org/jf/dexlib2/DexFileFactory.java +++ b/dexlib2/src/main/java/org/jf/dexlib2/DexFileFactory.java @@ -344,7 +344,8 @@ public final class DexFileFactory { * Performs a partial match against entry and targetEntry. * * This is considered a partial match if targetEntry is a suffix of entry, and if the suffix starts - * on a path "part" (ignoring the initial separator, if any). Both '/' and ':' are considered separators for this. + * on a path "part" (ignoring the initial separator, if any). '/' and ':' and '!' are considered separators for + * this. * * So entry="/blah/blah/something.dex" and targetEntry="lah/something.dex" shouldn't match, but * both targetEntry="blah/something.dex" and "/blah/something.dex" should match. @@ -364,7 +365,8 @@ public final class DexFileFactory { char firstTargetChar = targetEntry.charAt(0); // This is a device path, so we should always use the linux separator '/', rather than the current platform's // separator - return firstTargetChar == ':' || firstTargetChar == '/' || precedingChar == ':' || precedingChar == '/'; + return firstTargetChar == ':' || firstTargetChar == '/' || firstTargetChar == '!' || + precedingChar == ':' || precedingChar == '/' || precedingChar == '!'; } protected static class DexEntryFinder {