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

NPE when loading profiles, fails when sorting by version name #33

Open
eighthave opened this issue Aug 28, 2020 · 1 comment
Open

NPE when loading profiles, fails when sorting by version name #33

eighthave opened this issue Aug 28, 2020 · 1 comment

Comments

@eighthave
Copy link

eighthave commented Aug 28, 2020

I get this NPE when working with profiles I generated myself from the attached file.

$ libscout --opmode match --android-sdk /home/fdroid/android-sdk/platforms/android-29/android.jar --libscout-conf /home/fdroid/code/reddr/LibScout/config/LibScout.toml --log-dir /data/ttt-apks/libraries/run-match.sh-1598623728-logs --profiles-dir ./profiles --json-dir /data/ttt-apks/random-google-play//json /data/ttt-apks/random-google-play/
Exception in thread "main" java.lang.NullPointerException
        at de.infsec.tpl.profile.LibProfile$LibProfileComparator.compare(LibProfile.java:68)
        at de.infsec.tpl.profile.LibProfile$LibProfileComparator.compare(LibProfile.java:65)
        at java.base/java.util.TimSort.countRunAndMakeAscending(TimSort.java:355)
        at java.base/java.util.TimSort.sort(TimSort.java:234)
        at java.base/java.util.Arrays.sort(Arrays.java:1515)
        at java.base/java.util.ArrayList.sort(ArrayList.java:1750)
        at de.infsec.tpl.profile.Profile.loadLibraryProfiles(Profile.java:87)
        at de.infsec.tpl.TplCLI.main(TplCLI.java:122)

Here is my proposed fix for --opmode match:

--- a/src/de/infsec/tpl/profile/Profile.java
+++ b/src/de/infsec/tpl/profile/Profile.java
@@ -81,6 +81,10 @@ public abstract class Profile implements Serializable {
                        // de-serialize library profiles
                        for (File f : Utils.collectFiles(profilesDir, new String[]{LibraryProfiler.FILE_EXT_LIB_PROFILE})) {
                                LibProfile lp = (LibProfile) Utils.disk2Object(f);
+                               if (lp == null || lp.description == null) {
+                                   System.err.println("ERROR: " + f + " produces a null profile!");
+                                   continue;
+                               }
                                profiles.add(lp);
                        }
 

PyzeLibrary_2.5.0.libv.zip

@eighthave
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant