Ensure flow obstructor initializers always read a static field

This fixes a bug when deobfuscating the build 225 client, which has code
that looks like a flow obstructor initializer, but it reads an argument
rather than a static variable.

Signed-off-by: Graham <gpe@openrs2.org>
Graham 3 years ago
parent 2b720af6e5
commit 2292b9449c
  1. 19
      deob-bytecode/src/main/kotlin/org/openrs2/deob/bytecode/transform/OpaquePredicateTransformer.kt

@ -42,8 +42,25 @@ public class OpaquePredicateTransformer : Transformer() {
private fun findFlowObstructors(library: Library, method: MethodNode) {
for (match in FLOW_OBSTRUCTOR_INITIALIZER_MATCHER.match(method)) {
// add flow obstructor to set
val putstatic = match.last() as FieldInsnNode
/*
* if the initializer reads a local variable, check the local
* variable is populated with a static field
*/
val first = match.first()
if (first is VarInsnNode) {
val storeFound = STORE_MATCHER.match(method).any {
val istore = it[1] as VarInsnNode
return@any first.`var` == istore.`var`
}
if (!storeFound) {
continue
}
}
// add flow obstructor to set
flowObstructors.add(MemberRef(putstatic))
/*

Loading…
Cancel
Save