mirror of
https://github.com/revanced/Apktool.git
synced 2025-01-20 16:57:34 +01:00
StringBlock.getHTML(): escape XML chars before styling.
This commit is contained in:
parent
51ec9611f4
commit
2a20dd1b94
@ -125,7 +125,7 @@ public class StringBlock {
|
||||
}
|
||||
int[] style = getStyle(index);
|
||||
if (style == null) {
|
||||
return raw;
|
||||
return escapeForXml(raw);
|
||||
}
|
||||
StringBuilder html = new StringBuilder(raw.length() + 32);
|
||||
int offset = 0;
|
||||
@ -146,7 +146,7 @@ public class StringBlock {
|
||||
continue;
|
||||
}
|
||||
if (offset <= end) {
|
||||
html.append(raw, offset, end + 1);
|
||||
html.append(escapeForXml(raw.substring(offset, end + 1)));
|
||||
offset = end + 1;
|
||||
}
|
||||
style[j + 2] = -1;
|
||||
@ -156,7 +156,7 @@ public class StringBlock {
|
||||
html.append('>');
|
||||
}
|
||||
if (offset < start) {
|
||||
html.append(raw, offset, start);
|
||||
html.append(escapeForXml(raw.substring(offset, start)));
|
||||
offset = start;
|
||||
}
|
||||
if (i == -1) {
|
||||
@ -170,6 +170,10 @@ public class StringBlock {
|
||||
return html.toString();
|
||||
}
|
||||
|
||||
private String escapeForXml(String txt) {
|
||||
return txt.replace("&", "&").replace("<", "<");
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds index of the string.
|
||||
* Returns -1 if the string was not found.
|
||||
|
Loading…
x
Reference in New Issue
Block a user