mirror of
https://github.com/revanced/Apktool.git
synced 2025-01-22 17:57:35 +01:00
Prevent loading styles if style position is outside of string
- fixes #1453
This commit is contained in:
parent
ea16f3ff1d
commit
b09dce4050
@ -131,6 +131,11 @@ public class StringBlock {
|
|||||||
if (style == null) {
|
if (style == null) {
|
||||||
return ResXmlEncoders.escapeXmlChars(raw);
|
return ResXmlEncoders.escapeXmlChars(raw);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If the returned style is further in string, than string length. Lets skip it.
|
||||||
|
if (style[1] > raw.length()) {
|
||||||
|
return ResXmlEncoders.escapeXmlChars(raw);
|
||||||
|
}
|
||||||
StringBuilder html = new StringBuilder(raw.length() + 32);
|
StringBuilder html = new StringBuilder(raw.length() + 32);
|
||||||
int[] opened = new int[style.length / 3];
|
int[] opened = new int[style.length / 3];
|
||||||
int offset = 0, depth = 0;
|
int offset = 0, depth = 0;
|
||||||
|
@ -253,6 +253,11 @@ public class BuildAndDecodeTest {
|
|||||||
compareValuesFiles("values-ast/strings.xml");
|
compareValuesFiles("values-ast/strings.xml");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void androidOStringTest() throws BrutException, IOException {
|
||||||
|
compareValuesFiles("values-ast/strings.xml");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void twoLetterNotHandledAsBcpTest() throws BrutException, IOException {
|
public void twoLetterNotHandledAsBcpTest() throws BrutException, IOException {
|
||||||
checkFolderExists("res/values-fr");
|
checkFolderExists("res/values-fr");
|
||||||
|
@ -0,0 +1,9 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<string name="test1">"Forgot your username or password?\nVisit google.com/accounts/recovery."</string>
|
||||||
|
<string name="test2">Forgot your username or password?\n.Visit google.com/accounts/recovery</string>
|
||||||
|
<string name="test3"> (string8) "Forgot your username or password?\nVisit google.com/accounts/recovery."</string>
|
||||||
|
<string name="test4">Forgot your username or password?\nVisit google.com/accounts/recovery.</string>
|
||||||
|
<string name="test5">Forgot your username or password?
|
||||||
|
Visit google.com/accounts/recovery.</string>
|
||||||
|
</resources>
|
Loading…
x
Reference in New Issue
Block a user