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

[Bug] NPE while decompiling jar files with --enable-file-content #5275

Open
skirge opened this issue Jan 31, 2025 · 0 comments
Open

[Bug] NPE while decompiling jar files with --enable-file-content #5275

skirge opened this issue Jan 31, 2025 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@skirge
Copy link

skirge commented Jan 31, 2025

Describe the bug
NPE can occur if JAR file contains files other than .class (.xml for example)

To Reproduce
jimple2cpg -J-Xmx32G dir-with-jars --enable-file-content --output cpg.bin.zip

I forgot to save stacktrace, sorry.

This fixed it for me:

diff --git a/joern-cli/frontends/jimple2cpg/src/main/scala/io/joern/jimple2cpg/util/Decompiler.scala b/joern-cli/frontends/jimple2cpg/src/main/scala/io/joern/jimple2cpg/util/Decompiler.scala
index 58a96003f..9b08e2546 100644
--- a/joern-cli/frontends/jimple2cpg/src/main/scala/io/joern/jimple2cpg/util/Decompiler.scala
+++ b/joern-cli/frontends/jimple2cpg/src/main/scala/io/joern/jimple2cpg/util/Decompiler.scala
@@ -51,7 +51,7 @@ class Decompiler(classFile: List[File]) {
             val className = s.toString.split(" ").last
             logger.debug(s"Decompiling class '$className'")
           case OutputSinkFactory.SinkType.EXCEPTION =>
-            logger.error(s.toString)
+            logger.error(String.valueOf(s))
           case _ => // ignore
       }
     }
@skirge skirge added the bug Something isn't working label Jan 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants