Menu

#757 ProGuard 6.1.1 creates invalid byte code for nest based access (Java 11)

v6.2.1
closed-fixed
nobody
None
Medium
2020-02-27
2019-07-18
No

I encountered following bug in ProGuard 6.1.1 when processing a Java 11 compiled jar. This is related to the nest based access control feature introduced in Java 11 and is triggered in cases where Java 10 would have generated acess bridge methods.When changing access to public in the inner class the issue does not appear. I have put together a trivial java source file and jar to demonstrate the issue.

The byte code verifier displays this message in the obfuscated class. The original (not obfuscated) jar works as intended.


Error: Unable to initialize main class test.Host
Caused by: java.lang.VerifyError: Bad invokespecial instruction: current class isn't assignable to reference class.
Exception Details:
Location:
test/Host.main([Ljava/lang/String;)V @14: invokespecial
Reason:
Error exists in the bytecode
Bytecode:
0000000: bb00 0359 b700 0759 4b59 4bb4 0005 b700
0000010: 09b1

1 Attachments

Discussion

  • Heiko Wagner

    Heiko Wagner - 2019-07-18

    Jars created with OpenJDK 11.0.4 on Windows 10.
    TestIn.jar: executable jar file with original class file
    TestOut.jar: executable jar file created with ProGuard 6.1.1

     
  • Heiko Wagner

    Heiko Wagner - 2019-07-24

    The minimal code change to workaround the issue is to chage the outer class method to package local access.

     
  • Clive Wong

    Clive Wong - 2019-07-30

    I just got similar problem in my java application.
    After I change the outer class method from "private" to "protected" or "public" (or just remove "private"), it is ok. (However, if I change your example's getString() to "protected", the problem still exists.)
    I am also using Java 11 and proguard 6.1.1.

     

    Last edit: Clive Wong 2019-07-30
  • Hendrik Schreiber

    I'm seeing the same error message, but it seems to happen with nested try/catch blocks in a static initializer.

     
    • Hendrik Schreiber

      I have just tried ProGuard 6.2.0 and the issue still isn't solved (for me).
      What can we do to help?
      Do we need a better test case?

       
      👍
      1
  • G. Lampros

    G. Lampros - 2019-11-08

    I have a similar issue with open jdk 13 and latest version 6.2.0

    Exception in thread "Thread-0" java.lang.VerifyError: Bad invokespecial instruction: current class isn't assignable to reference class.
    Exception Details:
      Location:
        com/Framework/bR.mouseClicked(Ljava/awt/event/MouseEvent;)V @33: invokespecial
      Reason:
        Error exists in the bytecode
      Bytecode:
        0000000: 2bb6 000c c000 0359 4d2b b600 0bb6 0008
        0000010: 3d2b b600 0a05 a000 0e1c 9b00 0a2a b400
        0000020: 06b7 0007 b1
      Stackmap Table:
        chop_frame(@36,2)
    
            at com.Framework.bB.k(Unknown Source)
            at com.Framework.bB.<init>(Unknown Source)
    
     
  • Scott W Palmer

    Scott W Palmer - 2019-11-15

    Same here:
    Reason:
    Error exists in the bytecode
    Bytecode:
    0000000: 2ab4 000c 9900 082a b400 0db0 2ab4 000a
    0000010: b400 0959 4cc2 2ab4 000d c700 222a 59b4
    0000020: 000a 2ab4 000b b600 11b5 000d 2ab4 000a
    0000030: 2ab4 000d b700 0e2a 04b5 000c 2bc3 a700
    0000040: 084d 2bc3 2cbf 2ab4 000d b0
    Exception Handler Table:
    bci [22, 62] => handler: 65
    bci [65, 68] => handler: 65
    Stackmap Table:
    same_frame(@12)
    append_frame(@60,Object[#6])
    full_frame(@65,{Top,Object[#6]},{Object[#8]})
    full_frame(@70,{Object[#2]},{})

     

    Related

    Bugs: #2
    Bugs: #6
    Bugs: #8

  • T. Neidhart

    T. Neidhart - 2019-12-03

    This was also reported in this bug report: https://github.com/Guardsquare/proguard/issues/10

    We have fixed this in the meantime and the fix will be included in 6.2.1 available the next days.

     
  • T. Neidhart

    T. Neidhart - 2019-12-05
    • status: open --> closed-fixed
    • Group: v6.1 --> v6.2.1
     
  • T. Neidhart

    T. Neidhart - 2019-12-05

    Fixed and will be included in v6.2.1.

     
  • Scott W Palmer

    Scott W Palmer - 2020-02-20

    This is not fixed. As of 6.2.2 and 6.3.0beta1 I still get the same error. (Using JDK 13.0.2)

     

    Last edit: Scott W Palmer 2020-02-20
  • Scott W Palmer

    Scott W Palmer - 2020-02-27

    The test case I provided in the github report is passing now, but I get the exact same error in my actual application. Some case is still causing this problem.

     

Log in to post a comment.

MongoDB Logo MongoDB