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] Miss of casts among primitive types #718

Closed
bagipro opened this issue Jul 22, 2019 · 5 comments
Closed

[core] Miss of casts among primitive types #718

bagipro opened this issue Jul 22, 2019 · 5 comments
Labels
bug Core Issues in jadx-core module

Comments

@bagipro
Copy link
Collaborator

bagipro commented Jul 22, 2019

Checks before report

Describe error
Class com.paypal.android.p2pmobile.cfs.common.fragments.BaseShowCodeFragment

    private boolean isGoogleMapsInstalledAndEnabled() {
        int i = 0;
        try {
            return getActivity().getPackageManager().getApplicationInfo("com.google.android.apps.maps", i).enabled;
        } catch (android.content.pm.PackageManager.NameNotFoundException unused) {
            return i; // <<< should be boolean
        }
    }

Another example is in file com/paypal/android/sdk/contactless/reader/apdu/CApdu.java

    public CApdu(@NonNull Cla cla, @NonNull Ins ins, byte b, byte b2, @NonNull byte[] bArr) {
        this(cla, ins, b, b2, bArr, 0); // <<< 0 should be explicitly cast to byte, otherwise the referenced constructor is not found
    }

    public CApdu(@NonNull Cla cla, @NonNull Ins ins, byte b, byte b2, @NonNull byte[] bArr, byte b3) {
        this.f15523a = cla;
        this.f15524b = ins;
        this.f15525c = b;
        this.f15526d = b2;
        this.f15527e = bArr;
        this.f15528f = b3;
    }

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

@bagipro bagipro added bug Core Issues in jadx-core module labels Jul 22, 2019
@bagipro
Copy link
Collaborator Author

bagipro commented Jul 31, 2019

And one more example boolean to int in file com/paypal/android/p2pmobile/p2p/common/adapters/OptionsAdapter.java

    public int getItemCount() {
        boolean z = this.mHasFooter;
        List<OPTION> list = this.mOptions;
        if (list != null) {
            return list.size() + z; // int + boolean
        }
        return z ? 1 : 0;
    }

@codezjx
Copy link

codezjx commented Sep 2, 2019

Similar issue in method overloading:

public class n {
    private int a = 0;
    private long b = 0;
    public void a(int i) {
        this.a = i;
    }
    public void a(long j) {
        this.b = j;
    }
    ...
}

And jadx decompile result was:

a = new n();
a.a(i);
a.a(-1);   // Actually result should be a.a(-1L), calling method with Long type parameter

This issue exist in version 1.0.0.

@bagipro
Copy link
Collaborator Author

bagipro commented Oct 28, 2019

@skylot
I see that the second issue is fixed now

    public CApdu(@NonNull Cla cla, @NonNull Ins ins, byte b, byte b2, @NonNull byte[] bArr) {
        this(cla, ins, b, b2, bArr, (byte) 0);
    }

    public CApdu(@NonNull Cla cla, @NonNull Ins ins, byte b, byte b2, @NonNull byte[] bArr, byte b3) {

but not the first one

    private boolean isGoogleMapsInstalledAndEnabled() {
        int i = 0;
        try {
            return getActivity().getPackageManager().getApplicationInfo("com.google.android.apps.maps", i).enabled;
        } catch (PackageManager.NameNotFoundException unused) {
            return i;
        }
    }

@skylot
Copy link
Owner

skylot commented Oct 28, 2019

@sergey-wowwow I made a fix for the first one. Thanks for notice!

@skylot skylot closed this as completed Oct 28, 2019
@bagipro
Copy link
Collaborator Author

bagipro commented Oct 29, 2019

@skylot
Thanks!

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

3 participants