Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[core] Use of null in a field expression #964

Closed
bagipro opened this issue Aug 10, 2020 · 3 comments
Closed

[core] Use of null in a field expression #964

bagipro opened this issue Aug 10, 2020 · 3 comments
Assignees
Labels
bug Core Issues in jadx-core module
Milestone

Comments

@bagipro
Copy link
Collaborator

bagipro commented Aug 10, 2020

Class okio.Buffer

    @kotlin.jvm.JvmName(name = "getByte")
    public final byte getByte(long j) {
        okio.Util.checkOffsetAndCount(this.size, j, 1);
        okio.Segment segment = this.head;
        if (segment == null) {
            kotlin.jvm.internal.Intrinsics.throwNpe();
            return null.data[(int) ((((long) null.pos) + j) - -1)]; // <<<

and class com.google.android.gms.internal.ads.zzdo

                if (com.google.android.gms.internal.ads.zzdg.zzo(zzbj.zzcx) || zzto.zzcx.equals("E")) {
                    if (z) {
                        java.lang.String zzas = zzas();
                        if (!com.google.android.gms.internal.ads.zzdg.zzo(zzas)) {
                            zzto.zzcx = zzas;
                        }
                    } else if (z) {
                        zzto.zzcx = null.zzcx; // <<<
                    }
                }

APK: https://drive.google.com/file/d/1qC3tlWs9AtPBpyS6iU9kcSphLryfJOxi/view?usp=sharing

@bagipro bagipro added bug Core Issues in jadx-core module labels Aug 10, 2020
@skylot
Copy link
Owner

skylot commented Aug 10, 2020

@sergey-wowwow funny but this is exactly what bytecode do (kotlin inlining is weird sometimes).
Anyway, I forbid inlining of null for such cases so code must be compilable now.

@skylot skylot closed this as completed Aug 10, 2020
@bagipro
Copy link
Collaborator Author

bagipro commented Aug 11, 2020

Hi @skylot, thanks!

I've detected an error in the fix, class com.google.android.gms.measurement.internal.zzac

    @androidx.annotation.WorkerThread
    private final long zzb(java.lang.String str, java.lang.String[] strArr) {
        android.database.Cursor cursor = null;
        try {
            android.database.Cursor rawQuery = c_().rawQuery(str, strArr);
            if (rawQuery.moveToFirst()) {
                long j = rawQuery.getLong(0);
                if (rawQuery != null) {
                    rawQuery.close();
                }
                return j;
            }
            throw new android.database.sqlite.SQLiteException("Database returned empty set");
        } catch (android.database.sqlite.SQLiteException e) {
            zzr().zzf().zza("Database error", str, e);
            throw e;
        } catch (java.lang.Throwable th) {
            if (0 != 0) { // <<<<<<<
                cursor.close();
            }
            throw th;
        }
    }

Previous code

            if (cursor != null) {

@skylot skylot reopened this Aug 16, 2020
@skylot skylot added this to the v1.2.0 milestone Aug 16, 2020
@skylot skylot self-assigned this Aug 16, 2020
@skylot
Copy link
Owner

skylot commented Oct 29, 2020

Looks like this issue is same as #920 . Check this description.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Core Issues in jadx-core module
Projects
None yet
Development

No branches or pull requests

2 participants