jadx icon indicating copy to clipboard operation
jadx copied to clipboard

incorrect smali decompile

Open steelbytes opened this issue 1 year ago • 1 comments

The following smali is incorrectly decompiled.

I believe after the for loop z should be true if there was a non zero byte in the bytearray parameter (skipping first two).

smali is from apktool decompiling someone else's apk with a few linefeeds removed. java is from loading this smali in jadx 1.4.7

.method private a([B)V
    .locals 4

    const/4 v0, 0x1
    const/4 v1, 0x0   
    array-length v2, p1
    const/4 v3, 0x2
    if-le v2, v3, :cond_2

    :goto_0
    array-length v2, p1
    if-ge v3, v2, :cond_2
    aget-byte v2, p1, v3
    if-eqz v2, :cond_1
    goto :goto_1

    :cond_1
    add-int/lit8 v3, v3, 0x1
    goto :goto_0

    :cond_2
    move v0, v1

    :goto_1
    if-eqz v0, :cond_3
    const-string p1, "tag"
    const-string v0, "x"
    invoke-static {p1, v0}, Landroid/util/Log;->i(Ljava/lang/String;Ljava/lang/String;)I
    goto :goto_2

    :cond_3
    const-string p1, "tag"
    const-string v0, "y"
    invoke-static {p1, v0}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I

    :goto_2
    return-void
.end method
    private void a(byte[] bArr) {
        boolean z = true;
        if (bArr.length > 2) {
            for (int i = 2; i < bArr.length; i++) {
                if (bArr[i] != 0) {
                    break;
                }
            }
        }
        z = false;
        if (z) {
            Log.i("tag", "x");
        } else {
            Log.e("tag", "y");
        }
    }

steelbytes avatar Jul 18 '23 05:07 steelbytes

Any news?

steelbytes avatar Aug 26 '23 06:08 steelbytes