Menu

#712 NullPointerException crash when module-info.class is present

v6.0
closed-fixed
None
Medium
2019-05-14
2018-06-19
No

ProGuard consistently crashes with the following exception:

java.lang.NullPointerException
    at proguard.classfile.ProgramClass.constantPoolEntryAccept(ProgramClass.java:537)
    at proguard.shrink.UsageMarker.markConstant(UsageMarker.java:1246)
    at proguard.shrink.UsageMarker.visitRequiresInfo(UsageMarker.java:1040)
    at proguard.classfile.attribute.module.ModuleAttribute.requiresAccept(ModuleAttribute.java:138)
    at proguard.shrink.UsageMarker.visitModuleAttribute(UsageMarker.java:739)
    at proguard.classfile.attribute.module.ModuleAttribute.accept(ModuleAttribute.java:99)
    at proguard.classfile.ProgramClass.attributesAccept(ProgramClass.java:619)
    at proguard.shrink.UsageMarker.markProgramClassBody(UsageMarker.java:124)
    at proguard.shrink.UsageMarker.visitProgramClass(UsageMarker.java:94)
    at proguard.classfile.visitor.MultiClassVisitor.visitProgramClass(MultiClassVisitor.java:67)
    at proguard.classfile.visitor.MultiClassVisitor.visitProgramClass(MultiClassVisitor.java:67)
    at proguard.classfile.visitor.ClassNameFilter.visitProgramClass(ClassNameFilter.java:128)
    at proguard.classfile.ProgramClass.accept(ProgramClass.java:430)
    at proguard.classfile.ClassPool.classesAccept(ClassPool.java:124)
    at proguard.classfile.visitor.AllClassVisitor.visitClassPool(AllClassVisitor.java:45)
    at proguard.classfile.visitor.MultiClassPoolVisitor.visitClassPool(MultiClassPoolVisitor.java:85)
    at proguard.classfile.ClassPool.accept(ClassPool.java:110)
    at proguard.shrink.Shrinker.execute(Shrinker.java:90)
    at proguard.ProGuard.shrink(ProGuard.java:381)
    at proguard.ProGuard.execute(ProGuard.java:145)
    at proguard.ProGuard.main(ProGuard.java:572)

To reproduce the problem, please see the minimal example that's attached to this ticket. Steps to reproduce:

  1. Run ./download_jars.
  2. Run ./build.

The problem appears to be triggered by the module-info.class file that's inside asm-6.1.1.jar. Manually removing module-info.class from the JAR makes the crash go away.

A workaround, for anyone else encountering this problem, is to change -injars lib/asm-6.1.1.jar to -injars lib/asm-6.1.1.jar(!module-info.class).

This crash appears to be the same one discussed in the second half of [#704].

1 Attachments

Related

Bugs: #704

Discussion

  • Eric Lafortune

    Eric Lafortune - 2018-08-09

    Thanks for your detailed report and sorry about the delay. ProGuard is crashing on module-info classes with requires entries without version. The bug has now been fixed for the upcoming ProGuard 6.1. The field requiresInfo.u2requiresVersionIndex needs to be checked for 0 in core/src/proguard/shrink/UsageMarker.java and in core/src/proguard/classfile/editor/ConstantPoolShrinker.java.

     
  • Eric Lafortune

    Eric Lafortune - 2018-08-09
    • status: open --> open-fixed
     
  • Eric Lafortune

    Eric Lafortune - 2019-05-14
    • Status: open-fixed --> closed-fixed
     

Log in to post a comment.