mirror of
https://github.com/revanced/Apktool.git
synced 2025-01-06 10:05:54 +01:00
malformed styles
if styles are malformed html, then recreation fails with OutOfBounds, end tag if error occurs to prevent crash
This commit is contained in:
parent
f980cfad97
commit
d90bea10ce
1
CHANGES
1
CHANGES
@ -33,6 +33,7 @@ v2.0.0 (TBA)
|
||||
-Fixed (issue #601) - Make StringBlock thread safe (Thanks aluedeke)
|
||||
-Fixed (issue #238) - Fixed truncated UTF-16 strings
|
||||
-Fixed (issue #584) - Fixed horrible spacing, aligned for 4 spaces.
|
||||
-Fixed (issue #196) - Fixed style crash due to malformed styles.
|
||||
-Added output to list Apktool version to help debugging.
|
||||
-Updated known bytes for configurations to 38 (from addition of layout direction)
|
||||
-Fixed NPE when handling odex apks even with --no-src specified. (Thanks Rodrigo Chiossi)
|
||||
|
@ -184,18 +184,27 @@ public class StringBlock {
|
||||
boolean loop = true;
|
||||
while (loop) {
|
||||
int pos2 = tag.indexOf('=', pos + 1);
|
||||
builder.append(' ').append(tag.substring(pos + 1, pos2)).append("=\"");
|
||||
pos = tag.indexOf(';', pos2 + 1);
|
||||
|
||||
String val;
|
||||
if (pos != -1) {
|
||||
val = tag.substring(pos2 + 1, pos);
|
||||
// malformed style information will cause crash. so
|
||||
// prematurely end style tags, if recreation
|
||||
// cannot be created.
|
||||
if (pos2 != -1) {
|
||||
builder.append(' ').append(tag.substring(pos + 1, pos2)).append("=\"");
|
||||
pos = tag.indexOf(';', pos2 + 1);
|
||||
|
||||
String val;
|
||||
if (pos != -1) {
|
||||
val = tag.substring(pos2 + 1, pos);
|
||||
} else {
|
||||
loop = false;
|
||||
val = tag.substring(pos2 + 1);
|
||||
}
|
||||
|
||||
builder.append(ResXmlEncoders.escapeXmlChars(val)).append('"');
|
||||
} else {
|
||||
loop = false;
|
||||
val = tag.substring(pos2 + 1);
|
||||
}
|
||||
|
||||
builder.append(ResXmlEncoders.escapeXmlChars(val)).append('"');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="test_formatting1"><a href="http://www.foo.com" style="text-decoration:none;">http://www.foo.com</a></string>
|
||||
<string name="test_formatting2"><a href="http://www.foo.com" style="text-decoration:none">http://www.foo.com</a></string>
|
||||
</resources>
|
Loading…
Reference in New Issue
Block a user