charles2gan / GDA-android-reversing-Tool

the fastest and most powerful android decompiler(native tool working without Java VM) for the APK, DEX, ODEX, OAT, JAR, AAR, and CLASS file. which supports malicious behavior detection, privacy leaking detection, vulnerability detection, path solving, packer identification, variable tracking, deobfuscation, python&java scripts, device memory extraction, data decryption, and encryption, etc.
https://twitter.com/charles_gan1
Apache License 2.0
4.21k stars 526 forks source link

Smali出现明显的反编译错误 #133

Closed dvdface closed 1 year ago

dvdface commented 1 year ago

F5后显示出来该toString函数的Smali代码:

# Method Zoom [751c50-000046]
.class public Lic0/d0$$f;
.method public toString()Ljava/lang/String; # method@00b68b

# insnsSize 27 (16-bit)
.registers 3 # [ v0  v1  v2  ]
.prologue

0000: new-instance v0, Ljava/lang/StringBuilder;
0002: invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V
0005: const-string v1, "LightPush["
0007: invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
000a: invoke-virtual {v2}, Ljava/lang/Object;->hashCode()I
000d: move-result v1
000e: invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
0011: const-string v1, "]"
0013: invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
0016: invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
0019: move-result-object v0
001a: return-object v0

.end method

反编译后

    public String toString(){
       StringBuilder str = "";
       return str;
    }

对比VSCode中的Samli2Java插件的结果: `package ic0; / loaded from: D:\Users\80362386\AppData\Local\Temp\jadx-3251669352009374635.dex / public class d0$$f implements h { public final / synthetic / d0 d;

public d0$$f(d0 d0Var) {
    this.d = d0Var;
}

/* JADX WARN: Removed duplicated region for block: B:20:0x00e4 A[RETURN] */
/* JADX WARN: Removed duplicated region for block: B:21:0x00e5  */
/*
    Code decompiled incorrectly, please refer to instructions dump.
    To view partially-correct add '--show-bad-code' argument
*/
public boolean G0(java.util.Queue<ic0.h> r19) {
    /*
        Method dump skipped, instructions count: 260
        To view this dump add '--comments-level debug' option
    */
    throw new UnsupportedOperationException("Method not decompiled: ic0.d0$$f.G0(java.util.Queue):boolean");
}

public String toString() {
    return "LightPush[" + hashCode() + "]";
}

} `

附件无法上传,帖原始的smali:

.class public Lic0/d0$$f;
.super Ljava/lang/Object;
.source "SourceFile"

# interfaces
.implements Lic0/h;

# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Lic0/d0;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x1
    name = "f"
.end annotation

# instance fields
.field public final synthetic d:Lic0/d0;

# direct methods
.method public constructor <init>(Lic0/d0;)V
    .locals 0

    iput-object p1, p0, Lic0/d0$$f;->d:Lic0/d0;

    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    return-void
.end method

# virtual methods
.method public G0(Ljava/util/Queue;)Z
    .locals 18
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Ljava/util/Queue<",
            "Lic0/h;",
            ">;)Z"
        }
    .end annotation

    move-object/from16 v8, p0

    new-instance v0, Lcom/tencent/mm/pointers/PInt;

    invoke-direct {v0}, Lcom/tencent/mm/pointers/PInt;-><init>()V

    invoke-static {}, Lc40/a0;->h()Lc40/a0;

    invoke-static {}, Lc40/a0;->b()Lc40/e;

    move-result-object v1

    invoke-virtual {v1}, Lc40/e;->g()I

    move-result v1

    invoke-static {v0, v1}, Lcom/tencent/mm/booter/m;->f(Lcom/tencent/mm/pointers/PInt;I)[B

    move-result-object v1

    const/4 v2, 0x3

    new-array v3, v2, [Ljava/lang/Object;

    const/4 v4, 0x0

    aput-object v8, v3, v4

    iget v5, v0, Lcom/tencent/mm/pointers/PInt;->value:I

    invoke-static {v5}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v5

    const/4 v9, 0x1

    aput-object v5, v3, v9

    if-eqz v1, :cond_0

    array-length v5, v1

    goto :goto_0

    :cond_0
    const/4 v5, -0x1

    :goto_0
    invoke-static {v5}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v5

    const/4 v6, 0x2

    aput-object v5, v3, v6

    const-string v5, "MicroMsg.SyncService"

    const-string v7, "%s index:%d, buf.len:%d "

    invoke-static {v5, v7, v3}, Lcom/tencent/mm/sdk/platformtools/Log;->i(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)V

    iget v3, v0, Lcom/tencent/mm/pointers/PInt;->value:I

    if-eqz v3, :cond_3

    invoke-static {v1}, Lcom/tencent/mm/sdk/platformtools/Util;->isNullOrNil([B)Z

    move-result v3

    if-eqz v3, :cond_1

    goto/16 :goto_3

    :cond_1
    iget v3, v0, Lcom/tencent/mm/pointers/PInt;->value:I

    const/4 v7, 0x0

    :try_start_0
    new-instance v0, Lbd3/q0;

    invoke-direct {v0}, Lbd3/q0;-><init>()V

    invoke-virtual {v0, v1}, Lbd3/q0;->fromProtoBuf([B)I

    iget-object v0, v0, Lbd3/q0;->a:Led3/d23;
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_1
    .catch Ljava/lang/Error; {:try_start_0 .. :try_end_0} :catch_0

    move-object v5, v0

    goto/16 :goto_2

    :catch_0
    move-exception v0

    sget-object v10, Lhi2/d;->e:Lhi2/d;

    const-wide/16 v11, 0x63

    const-wide/16 v13, 0x27

    const-wide/16 v15, 0x1

    const/16 v17, 0x0

    invoke-virtual/range {v10 .. v17}, Lhi2/d;->idkeyStat(JJJZ)V

    invoke-static {}, Ljava/lang/Runtime;->getRuntime()Ljava/lang/Runtime;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/Runtime;->freeMemory()J

    move-result-wide v10

    const-wide/16 v12, 0x3e8

    div-long/2addr v10, v12

    invoke-static {}, Ljava/lang/Runtime;->getRuntime()Ljava/lang/Runtime;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/Runtime;->totalMemory()J

    move-result-wide v14

    div-long/2addr v14, v12

    const/4 v1, 0x6

    new-array v1, v1, [Ljava/lang/Object;

    aput-object v8, v1, v4

    invoke-static {v3}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v12

    aput-object v12, v1, v9

    invoke-static {v10, v11}, Ljava/lang/Long;->valueOf(J)Ljava/lang/Long;

    move-result-object v12

    aput-object v12, v1, v6

    invoke-static {v14, v15}, Ljava/lang/Long;->valueOf(J)Ljava/lang/Long;

    move-result-object v6

    aput-object v6, v1, v2

    const/4 v2, 0x4

    sub-long/2addr v14, v10

    invoke-static {v14, v15}, Ljava/lang/Long;->valueOf(J)Ljava/lang/Long;

    move-result-object v6

    aput-object v6, v1, v2

    const/4 v2, 0x5

    invoke-virtual {v0}, Ljava/lang/Throwable;->getMessage()Ljava/lang/String;

    move-result-object v0

    aput-object v0, v1, v2

    const-string v0, "%s index:%s memoryInfo avail/total, dalvik[%dk, %dk, user:%dk] Error[%s]"

    invoke-static {v5, v0, v1}, Lcom/tencent/mm/sdk/platformtools/Log;->i(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)V

    invoke-static {}, Lc40/a0;->h()Lc40/a0;

    invoke-static {}, Lc40/a0;->b()Lc40/e;

    move-result-object v0

    invoke-virtual {v0}, Lc40/e;->g()I

    move-result v0

    invoke-static {v3, v0}, Lcom/tencent/mm/booter/m;->b(II)V

    goto :goto_1

    :catch_1
    move-exception v0

    sget-object v10, Lhi2/d;->e:Lhi2/d;

    const-wide/16 v11, 0x63

    const-wide/16 v13, 0x26

    const-wide/16 v15, 0x1

    const/16 v17, 0x0

    invoke-virtual/range {v10 .. v17}, Lhi2/d;->idkeyStat(JJJZ)V

    new-array v1, v2, [Ljava/lang/Object;

    aput-object v8, v1, v4

    invoke-static {v3}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v2

    aput-object v2, v1, v9

    invoke-virtual {v0}, Ljava/lang/Throwable;->getMessage()Ljava/lang/String;

    move-result-object v0

    aput-object v0, v1, v6

    const-string v0, "%s index:%s Resp fromProtoBuf failed e[%s]"

    invoke-static {v5, v0, v1}, Lcom/tencent/mm/sdk/platformtools/Log;->e(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)V

    invoke-static {}, Lc40/a0;->h()Lc40/a0;

    invoke-static {}, Lc40/a0;->b()Lc40/e;

    move-result-object v0

    invoke-virtual {v0}, Lc40/e;->g()I

    move-result v0

    invoke-static {v3, v0}, Lcom/tencent/mm/booter/m;->b(II)V

    :goto_1
    move-object v5, v7

    :goto_2
    if-nez v5, :cond_2

    return v4

    :cond_2
    sget-object v10, Lhi2/d;->e:Lhi2/d;

    const-wide/16 v11, 0x63

    const-wide/16 v13, 0x14

    const-wide/16 v15, 0x1

    const/16 v17, 0x0

    invoke-virtual/range {v10 .. v17}, Lhi2/d;->idkeyStat(JJJZ)V

    new-instance v1, Lic0/d0$$e;

    iget-object v2, v8, Lic0/d0$$f;->d:Lic0/d0;

    const/4 v4, 0x1

    new-instance v6, Lic0/d0$$f$a;

    invoke-direct {v6, v8, v3}, Lic0/d0$$f$a;-><init>(Lic0/d0$$f;I)V

    const/4 v7, 0x0

    move-object/from16 v3, p0

    invoke-direct/range {v1 .. v7}, Lic0/d0$$e;-><init>(Lic0/d0;Lic0/h;ZLed3/d23;Lic0/g;Lic0/d0$$c;)V

    return v9

    :cond_3
    :goto_3
    return v4
.end method

.method public toString()Ljava/lang/String;
    .locals 2

    new-instance v0, Ljava/lang/StringBuilder;

    invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V

    const-string v1, "LightPush["

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {p0}, Ljava/lang/Object;->hashCode()I

    move-result v1

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    const-string v1, "]"

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    return-object v0
.end method
charles2gan commented 1 year ago

4.06优化出了问题,暂时先用回4.05或者4.04,下个版本更新。

charles2gan commented 1 year ago

做了下紧急更新,见4.06