mirror of
https://github.com/revanced/Apktool.git
synced 2025-01-21 09:17:35 +01:00
Prevent loading from resource pool if type is not a resolveable resource (#3187)
* perf: prefer the shifted resId vs expensive package calls * fix: only lookup values if reference/value
This commit is contained in:
parent
261003316e
commit
d4ec44de41
@ -387,7 +387,14 @@ public class AXmlResourceParser implements XmlResourceParser {
|
|||||||
if (mAttrDecoder != null) {
|
if (mAttrDecoder != null) {
|
||||||
try {
|
try {
|
||||||
String stringBlockValue = valueRaw == -1 ? null : ResXmlEncoders.escapeXmlChars(mStringBlock.getString(valueRaw));
|
String stringBlockValue = valueRaw == -1 ? null : ResXmlEncoders.escapeXmlChars(mStringBlock.getString(valueRaw));
|
||||||
String resourceMapValue = mAttrDecoder.decodeFromResourceId(valueData);
|
String resourceMapValue = null;
|
||||||
|
|
||||||
|
// Ensure we only track down obfuscated values for reference/attribute type values. Otherwise we might
|
||||||
|
// spam lookups against resource table for invalid ids.
|
||||||
|
if (valueType == TypedValue.TYPE_REFERENCE || valueType == TypedValue.TYPE_DYNAMIC_REFERENCE ||
|
||||||
|
valueType == TypedValue.TYPE_ATTRIBUTE || valueType == TypedValue.TYPE_DYNAMIC_ATTRIBUTE) {
|
||||||
|
resourceMapValue = mAttrDecoder.decodeFromResourceId(valueData);
|
||||||
|
}
|
||||||
String value = stringBlockValue;
|
String value = stringBlockValue;
|
||||||
|
|
||||||
if (stringBlockValue != null && resourceMapValue != null) {
|
if (stringBlockValue != null && resourceMapValue != null) {
|
||||||
|
@ -46,10 +46,8 @@ public class ResAttrDecoder {
|
|||||||
throws AndrolibException {
|
throws AndrolibException {
|
||||||
|
|
||||||
if (attrResId != 0) {
|
if (attrResId != 0) {
|
||||||
ResID resId = new ResID(attrResId);
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
ResResSpec resResSpec = mResTable.getResSpec(resId);
|
ResResSpec resResSpec = mResTable.getResSpec(attrResId);
|
||||||
if (resResSpec != null) {
|
if (resResSpec != null) {
|
||||||
return resResSpec.getName();
|
return resResSpec.getName();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user