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

Some potential NullPointerException bugs #133

Open
JulyChen728 opened this issue Nov 14, 2019 · 1 comment
Open

Some potential NullPointerException bugs #133

JulyChen728 opened this issue Nov 14, 2019 · 1 comment

Comments

@JulyChen728
Copy link

Hi all,
Our bug scanner has reported some NPE bugs.

1.The first bug is at Jar.java#L459 . Since the variable zis may be null , a NPE bug may take place when zis invokes its method getNextEntry() .

2.The second bug is at Capsule.java#L1715 . Since the variable server may be null , a NPE bug may take place when server invokes its method setSoTimeout() .

A similar situation is at Capsule.java#L5362 . (The variable out may be null.)

3.The third bug is at Capsule.java#L1229 . Since the variable defaultValue is checked for whether being null or not at Capsule.java#L1231 , a NPE bug may take place when defaultValue invokes its method equals() at Capsule.java#L1229 .

4.The forth bug is at Capsule.java#L3341 . Since the variable type is checked for whether being null or not at Capsule.java#L3351 , a NPE bug may take place when defaultValue invokes its method equals() at Capsule.java#L3341 .

5.The fifth bug is caused by the return null in method getAfter() . A NPE bug may take place when the return value of method getAfter() invokes its method substring() .

6.The sixth bug is caused by the return value of the method getAttribute0(). Since the if statement block may be skipped, the method getAttribute0() may return null. A possible call chain is attribute00() => attribute0() =>getAttribute() =>isDependency() . A NPE bug may take place in isDependency() when the parameter lib invokes its method contains() .

Some other NPE bugs are at Capsule.java#L2451 , Capsule.java#L843 , Capsule.java#L4001 , Capsule.java#L2514(when the method size() is invoked) .

7.The seventh bug is caused by the return null in method accessible() . A NPE may take place when the return value of method accessible() invokes its method set().

Some similar situations are at Capsule.java#L5637 , Capsule.java#L5476-5477 , Capsule.java#L5601 , Capsule.java#L5620

Another possible call chain is Capsule.java#L4835 =>Capsule.java#L4826 =>Capsule.java#L608 . And a NPE bug may take place when the method getDeclaringClass() is invoked.

The third possible call chain is Capsule.java#L4835 =>Capsule.java#L1311 . A NPE bug may take place when the method invoke() is invoked.

8.The eighth bug is caused by the return null in method toAbsolutePath() . A possible call chain is Capsule.java#L2067 =>Capsule.java#L2073 . And a NPE bug may take place in method extractCapsule() when the parameter dir invokes its method toAbsolutePath().

Another possible call chain is Capsule.java#L2067=>Capsule.java#L2070=>Capsule.java#L2104 . And a NPE bug may take place in method lockAppCache() when the parameter dir invokes its method resolve().

The third possible call chain is Capsule.java#L2067=>Capsule.java#L2070=>Capsule.java#L2105 . And a NPE bug may take place in method testAppCacheUpToDate() when the parameter dir invokes its method resolve().

Similar situations are at Capsule.java#L2072 => Capsule.java#L2088 , Capsule.java#L2070 => Capsule.java#L2107 => Capsule.java#L2173 .

9.The ninth bug is caused by the return null in method resolve() . A possible call chain is Capsule.java#L2228=>Capsule.java#L2234. And a NPE bug may take place in method handleLongClasspath() when the parameter cp invokes its method size().

Another call chain is Capsule.java#L2223=>Capsule.java#L2285=>Capsule.java#L4704 . A NPE bug may take place when the method iterator() is invoked.

10.The tenth bug is caused by the return null in method firstOrNull() . A NPE bug may take place at Capsule.java#L3542 when the method toString() of the parameter p is invoked.

11.The eleventh bug is caused by the return null in method name() . It may cause a NPE bug when the equals() method is invoked.

12.The twelfth bug is caused by the return null in method getCacheDir() . It may cause a NPE bug when the resolve() method is invoked.

13.The thirteenth bug is caused by the return null in method getProperty0() . A possible call chain is getProperty() =>Capsule.java#L218 . A NPE bug may take place when the method toLowerCase() is invoked.

14.The fourteenth bug is caused by the return null in method shortJavaVersion() . A NPE bug may take place when the method split() is invoked.

15.The fifteenth bug is caused by the return null in method lookupInAttribute() . A possible call chain is Capsule.java#L3181 => Capsule.java#L2735 => Capsule.java#L1492 . A NPE bug may take place when the booleanValue() method is invoked at Capsule.java#L1492.

16.The sixteenth bug is caused by the return null in method simpleResolve() . A possible call chain is Capsule.java#L3525 => Capsule.java#L3533 . A NPE bug may take place when the getParent() method is invoked .

17.The seventeenth bug is caused by the return null in method split() . A possible call chain is Capsule.java#L2445 => Capsule.java#L2446 . A NPE bug may take place when the remove() method is invoked .

18.The eighteenth bug is caused by the return null in method getTempDir() . A possible call chain is Capsule.java#L5290 . A NPE bug may take place in method createPathingJar() when the toAbsolutePath() method is invoked since the parameter dir may be null.

19.The nineteenth bug is caused by the return null in method getAppArtifactId() . A possible call chain is Capsule.java#L2655 =>Capsule.java#L2881 =>MyCapsule.java#L42 . And a NPE bug may take place when the method listIterator() is invoked.

20.The twentyth bug is caused by the return null in method getAppArtifactId() . A possible call chain is Capsule.java#L2672 =>Capsule.java#L2881 =>MyCapsule.java#L36 . And a NPE bug may take place when the method put() is invoked.

Thanks.

@ITWOI
Copy link

ITWOI commented Nov 21, 2019

Hi, we have reported the bugs a while ago would you please take a look and confirm if they are real bugs. We have been conducting an experiment to measure the accuracy of our static checker. We would be deeply appreciated if you can provide some feedback!

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

2 participants