Menu ▾ ▴

#654 NPE in proguard.classfile.ProgramClass.constantPoolEntryAccept

v5.3.3
closed-fixed
None
5
2018-02-07
2017-07-14
No

Hi,
I get a NPE during optimizing my large jar. I could not track it down to a small example (and it is closed source, so I'm not allowed to upload it)
Therefore, I checked out the source and debugged ProGuard.

The following changed fixed the problem - at proguard.classfile.ProgramClass.constantPoolEntryAccept(int, ConstantVisitor)

   public void constantPoolEntryAccept(int index, ConstantVisitor constantVisitor)
    {
         if (constantPool[index] != null)
         {
             constantPool[index].accept(this, constantVisitor);
         }
    }

(index value was 0, and constantPool[0] was null)

Used compiler: Eclipse

I don't know if this null pointer may cause any wrong byte code gereation, but my application run with this change.

Discussion

  • Maik

    Maik - 2018-01-29

    We also got a NPE at proguard.classfile.ProgramClass.constantPoolEntryAccept(ProgramClass.java:465). See the stacktrace below. It occured using version 5.2.1 and it still occurs using version 5.3.3.

     java.lang.NullPointerException
        at proguard.classfile.ProgramClass.constantPoolEntryAccept(ProgramClass.java:465)
        at proguard.classfile.editor.ConstantPoolShrinker.markConstant(ConstantPoolShrinker.java:534)
        at proguard.classfile.editor.ConstantPoolShrinker.visitParameterInfo(ConstantPoolShrinker.java:422)
        at proguard.classfile.attribute.MethodParametersAttribute.parametersAccept(MethodParametersAttribute.java:77)
        at proguard.classfile.editor.ConstantPoolShrinker.visitMethodParametersAttribute(ConstantPoolShrinker.java:260)
        at proguard.classfile.attribute.MethodParametersAttribute.accept(MethodParametersAttribute.java:63)
        at proguard.classfile.ProgramMethod.attributesAccept(ProgramMethod.java:81)
        at proguard.classfile.editor.ConstantPoolShrinker.visitProgramMember(ConstantPoolShrinker.java:116)
        at proguard.classfile.util.SimplifiedVisitor.visitProgramMethod(SimplifiedVisitor.java:92)
        at proguard.classfile.ProgramMethod.accept(ProgramMethod.java:73)
        at proguard.classfile.ProgramClass.methodsAccept(ProgramClass.java:516)
        at proguard.classfile.editor.ConstantPoolShrinker.visitProgramClass(ConstantPoolShrinker.java:84)
        at proguard.classfile.ProgramClass.accept(ProgramClass.java:358)
        at proguard.classfile.ClassPool.classesAccept(ClassPool.java:124)
        at proguard.obfuscate.Obfuscator.execute(Obfuscator.java:472)
        at proguard.ProGuard.obfuscate(ProGuard.java:355)
        at proguard.ProGuard.execute(ProGuard.java:152)
        at proguard.ProGuard.main(ProGuard.java:538)
    

    @Eric: Could you please have a look?! Unfortunately I can't upload our code either. Is there any chance to figure out what code (class, method, whatever) caused the problem?

    Thanks in advance,

    Maik

     

    Last edit: Maik 2018-01-29
  • Maik

    Maik - 2018-02-01

    The problem also exists in version 6.0 beta2. Due to this problem we are currently not able to obfuscate. Any chance that you can have a look soon?

    Best regards,

    Maik

     
  • Eric Lafortune

    Eric Lafortune - 2018-02-04

    Thanks for your report. The problem is triggered by a MethodParameters attribute with a nameless parameter. I've now fixed it for the upcoming ProGuard 6.0. Fro now, you can probably work around it by disabling the generation of these (optional) MethodParameters attributes in the compiler.

     
  • Eric Lafortune

    Eric Lafortune - 2018-02-04
    • status: open --> open-fixed
     
  • Eric Lafortune

    Eric Lafortune - 2018-02-05
    • Status: open-fixed --> closed-fixed
     
  • Maik

    Maik - 2018-02-07

    Thank you very much Eric!

     

Log in to post a comment.