From 8ab69657b7bbb9164ecbc70b9caf8715d7cef1b2 Mon Sep 17 00:00:00 2001 From: ThisTestUser Date: Sat, 25 Jul 2020 15:34:02 -0400 Subject: [PATCH] Bump ASM version to 8.0.1 --- pom.xml | 13 ++++++------ .../deobfuscator/executor/MethodExecutor.java | 20 +++++++++++++++---- .../executor/defined/JVMMethodProvider.java | 2 ++ .../special/ParamorphismTransformer.java | 4 ++-- .../HideAccessObfuscationTransformer.java | 4 ++-- .../ReflectionObfuscationTransformer.java | 2 +- 6 files changed, 30 insertions(+), 15 deletions(-) diff --git a/pom.xml b/pom.xml index 8ba0e2c3..c6b6da50 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ 1.0.0 UTF-8 - 6.0 + 8.0.1 src/main/java @@ -142,11 +142,6 @@ 4.12 test - - com.javadeobfuscator - javavm - 3.0.0 - @@ -174,5 +169,11 @@ asm-analysis ${version.asm} + + + com.javadeobfuscator + javavm + 3.0.0 + diff --git a/src/main/java/com/javadeobfuscator/deobfuscator/executor/MethodExecutor.java b/src/main/java/com/javadeobfuscator/deobfuscator/executor/MethodExecutor.java index 4dd81859..460ed876 100644 --- a/src/main/java/com/javadeobfuscator/deobfuscator/executor/MethodExecutor.java +++ b/src/main/java/com/javadeobfuscator/deobfuscator/executor/MethodExecutor.java @@ -1706,9 +1706,15 @@ else if(argumentTypes[i + 3].getSort() == Type.DOUBLE) case CHECKCAST: { TypeInsnNode cast = (TypeInsnNode) now; JavaValue obj = stack.get(0); + Type type; + try { + type = Type.getType(cast.desc); + } catch (Throwable ignored) { + type = Type.getObjectType(cast.desc); + } if (obj.value() != null) { - if (context.provider.canCheckcast(obj, Type.getType(cast.desc), context)) { - if (!context.provider.checkcast(obj, Type.getType(cast.desc), context)) { + if (context.provider.canCheckcast(obj, type, context)) { + if (!context.provider.checkcast(obj, type, context)) { throw new ClassCastException(cast.desc); } } else { @@ -1720,8 +1726,14 @@ else if(argumentTypes[i + 3].getSort() == Type.DOUBLE) case INSTANCEOF: { TypeInsnNode cast = (TypeInsnNode) now; JavaValue obj = stack.remove(0); - if (context.provider.canCheckInstanceOf(obj, Type.getType(cast.desc), context)) { - boolean is = context.provider.instanceOf(obj, Type.getType(cast.desc), context); + Type type; + try { + type = Type.getType(cast.desc); + } catch (Throwable ignored) { + type = Type.getObjectType(cast.desc); + } + if (context.provider.canCheckInstanceOf(obj, type, context)) { + boolean is = context.provider.instanceOf(obj, type, context); stack.add(0, new JavaInteger(is ? 1 : 0)); } else { throw new NoSuchComparisonHandlerException("No comparator found for " + cast.desc); diff --git a/src/main/java/com/javadeobfuscator/deobfuscator/executor/defined/JVMMethodProvider.java b/src/main/java/com/javadeobfuscator/deobfuscator/executor/defined/JVMMethodProvider.java index f59a6d68..2b4b292b 100644 --- a/src/main/java/com/javadeobfuscator/deobfuscator/executor/defined/JVMMethodProvider.java +++ b/src/main/java/com/javadeobfuscator/deobfuscator/executor/defined/JVMMethodProvider.java @@ -256,6 +256,7 @@ public class JVMMethodProvider extends MethodProvider { targetObject.initialize(new String(args.get(0).as(byte[].class), args.get(1).as(String.class))); return null; }); + put("getBytes()[B", (targetObject, args, context) -> targetObject.as(String.class).getBytes()); put("getBytes(Ljava/nio/charset/Charset;)[B", (targetObject, args, context) -> targetObject.as(String.class).getBytes(args.get(0).as(Charset.class))); put("toString()Ljava/lang/String;", (targetObject, args, context) -> targetObject.as(String.class).toString()); put("intern()Ljava/lang/String;", (targetObject, args, context) -> targetObject.as(String.class).intern()); @@ -674,6 +675,7 @@ public class JVMMethodProvider extends MethodProvider { return null; }); put("parseInt(Ljava/lang/String;)I", (targetObject, args, context) -> Integer.parseInt(args.get(0).as(String.class))); + put("parseInt(Ljava/lang/String;I)I", (targetObject, args, context) -> Integer.parseInt(args.get(0).as(String.class), args.get(1).intValue())); put("valueOf(Ljava/lang/String;)Ljava/lang/Integer;", (targetObject, args, context) -> Integer.valueOf(args.get(0).as(String.class))); put("valueOf(Ljava/lang/String;I)Ljava/lang/Integer;", (targetObject, args, context) -> Integer.valueOf(args.get(0).as(String.class), args.get(1).intValue())); put("valueOf(I)Ljava/lang/Integer;", (targetObject, args, context) -> Integer.valueOf(args.get(0).intValue())); diff --git a/src/main/java/com/javadeobfuscator/deobfuscator/transformers/special/ParamorphismTransformer.java b/src/main/java/com/javadeobfuscator/deobfuscator/transformers/special/ParamorphismTransformer.java index a8629e0f..401d6dd8 100644 --- a/src/main/java/com/javadeobfuscator/deobfuscator/transformers/special/ParamorphismTransformer.java +++ b/src/main/java/com/javadeobfuscator/deobfuscator/transformers/special/ParamorphismTransformer.java @@ -62,7 +62,7 @@ public boolean transform() provider.register(new ComparisonProvider() { @Override public boolean instanceOf(JavaValue target, Type type, Context context) { - if(target.type().equals("java/lang/Class") + if(target.type().equals("Ljava/lang/Class;") && type.getDescriptor().equals("Ljava/lang/Class;")) return true; return false; @@ -85,7 +85,7 @@ public boolean checkEquality(JavaValue first, JavaValue second, Context context) @Override public boolean canCheckInstanceOf(JavaValue target, Type type, Context context) { - if(type.getDescriptor().equals("java/lang/Class")) + if(type.getDescriptor().equals("Ljava/lang/Class;")) return true; return false; } diff --git a/src/main/java/com/javadeobfuscator/deobfuscator/transformers/stringer/HideAccessObfuscationTransformer.java b/src/main/java/com/javadeobfuscator/deobfuscator/transformers/stringer/HideAccessObfuscationTransformer.java index cf3c2af5..f7dd9a6e 100644 --- a/src/main/java/com/javadeobfuscator/deobfuscator/transformers/stringer/HideAccessObfuscationTransformer.java +++ b/src/main/java/com/javadeobfuscator/deobfuscator/transformers/stringer/HideAccessObfuscationTransformer.java @@ -594,7 +594,7 @@ private class MyInterpreter extends BasicInterpreter public BasicValue newValue(final Type type) { if(type == null) - return new BasicValue(Type.getType("java/lang/Object")); + return new BasicValue(Type.getType("Ljava/lang/Object;")); switch(type.getSort()) { case Type.VOID: @@ -633,7 +633,7 @@ public BasicValue binaryOperation(final AbstractInsnNode insn, public BasicValue merge(final BasicValue v, final BasicValue w) { if(!v.equals(w)) - return new BasicValue(Type.getType("java/lang/Object")); + return new BasicValue(Type.getType("Ljava/lang/Object;")); return v; } } diff --git a/src/main/java/com/javadeobfuscator/deobfuscator/transformers/zelix/ReflectionObfuscationTransformer.java b/src/main/java/com/javadeobfuscator/deobfuscator/transformers/zelix/ReflectionObfuscationTransformer.java index d4250924..69a41b45 100644 --- a/src/main/java/com/javadeobfuscator/deobfuscator/transformers/zelix/ReflectionObfuscationTransformer.java +++ b/src/main/java/com/javadeobfuscator/deobfuscator/transformers/zelix/ReflectionObfuscationTransformer.java @@ -81,7 +81,7 @@ public int inlineReflection(int expected) throws Throwable { provider.register(new ComparisonProvider() { @Override public boolean instanceOf(JavaValue target, Type type, Context context) { - return type.getDescriptor().equals("java/lang/String") && target.value() instanceof String; + return type.getDescriptor().equals("Ljava/lang/String;") && target.value() instanceof String; } @Override