mirror of
https://github.com/revanced/Apktool.git
synced 2025-06-13 05:27:36 +02: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:
@ -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>
|
Reference in New Issue
Block a user