Fixed synchronization in uninitialized class fields detector

Escaping placeobject.name
Better error log messages in some cases
This commit is contained in:
Jindra Petřík
2025-07-02 20:56:20 +02:00
parent 6375f69b3e
commit 0162e90871
17 changed files with 376 additions and 307 deletions
@@ -620,8 +620,53 @@ public class IdentifiersDeobfuscation {
}
return writer;
}
}
/**
* Escapes obfuscated identifier.
*
* @param s String
* @return Escaped string
*/
public static String escapeOIdentifier(String s) {
StringBuilder ret = new StringBuilder(s.length());
for (int i = 0; i < s.length(); i++) {
char c = s.charAt(i);
if (c == '\n') {
ret.append("\\n");
} else if (c == '\r') {
ret.append("\\r");
} else if (c == '\t') {
ret.append("\\t");
} else if (c == '\b') {
ret.append("\\b");
} else if (c == '\f') {
ret.append("\\f");
} else if (c == '\\') {
ret.append("\\\\");
} else if (c == '\u00A7') {
ret.append("\\\u00A7");
} else if (c < 32) {
ret.append("\\x").append(Helper.byteToHex((byte) c));
} else {
int num = 1;
for (int j = i + 1; j < s.length(); j++) {
if (s.charAt(j) == c) {
num++;
} else {
break;
}
}
if (num > Configuration.limitSameChars.get()) {
ret.append("\\{").append(num).append("}");
i += num - 1;
}
ret.append(c);
}
}
return ret.toString();
}
/**
* Unescapes deobfuscated identifier
@@ -678,52 +723,6 @@ public class IdentifiersDeobfuscation {
return ret.toString();
}
/**
* Escapes obfuscated identifier.
*
* @param s String
* @return Escaped string
*/
public static String escapeOIdentifier(String s) {
StringBuilder ret = new StringBuilder(s.length());
for (int i = 0; i < s.length(); i++) {
char c = s.charAt(i);
if (c == '\n') {
ret.append("\\n");
} else if (c == '\r') {
ret.append("\\r");
} else if (c == '\t') {
ret.append("\\t");
} else if (c == '\b') {
ret.append("\\b");
} else if (c == '\f') {
ret.append("\\f");
} else if (c == '\\') {
ret.append("\\\\");
} else if (c == '\u00A7') {
ret.append("\\\u00A7");
} else if (c < 32) {
ret.append("\\x").append(Helper.byteToHex((byte) c));
} else {
int num = 1;
for (int j = i + 1; j < s.length(); j++) {
if (s.charAt(j) == c) {
num++;
} else {
break;
}
}
if (num > Configuration.limitSameChars.get()) {
ret.append("\\{").append(num).append("}");
i += num - 1;
}
ret.append(c);
}
}
return ret.toString();
}
/**
* Clears cache.