-
Notifications
You must be signed in to change notification settings - Fork 467
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support additional edge cases in binary XML decoding
- Loading branch information
Showing
9 changed files
with
154 additions
and
475 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
recaf-api/src/main/java/software/coley/recaf/util/android/AndroidChunkUtil.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package software.coley.recaf.util.android; | ||
|
||
import org.checkerframework.checker.units.qual.N; | ||
import software.coley.recaf.util.ByteHeaderUtil; | ||
|
||
/** | ||
* Hacky utils for Android chunk utils. | ||
* | ||
* @author Matt Coley | ||
*/ | ||
public class AndroidChunkUtil { | ||
private static int[] EMPTY_HEADER = new int[2]; | ||
private static int[] ANDROID_PERMISSION = new int[]{ | ||
'a', 'n', 'd', 'r', 'o', 'i', 'd', '.', | ||
'p', 'e', 'r', 'm', 'i', 's', 's', 'i', 'o', 'n' | ||
}; | ||
private static int[] INTENT_FILTER = new int[]{ | ||
'i', 'n', 't', 'e', 'n', 't', '-', | ||
'f', 'i', 'l', 't', 'e', 'r' | ||
}; | ||
|
||
/** | ||
* @param data | ||
* Data to check. | ||
* | ||
* @return {@code true} if likely obscured XML chunk model. | ||
*/ | ||
public static boolean isObscuredXml(@N byte[] data) { | ||
return ByteHeaderUtil.match(data, EMPTY_HEADER) && | ||
(ByteHeaderUtil.matchAtAnyOffset(data, ANDROID_PERMISSION) || | ||
ByteHeaderUtil.matchAtAnyOffset(data, INTENT_FILTER)); | ||
} | ||
} |
97 changes: 0 additions & 97 deletions
97
recaf-api/src/main/java/software/coley/recaf/util/android/AndroidFormatting.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.