Overwritten function getting different name
Java class file shrinker, optimizer, obfuscator, and preverifier
Brought to you by:
guardsquare
Hi,
I have a constellation where ProGuard is giving an overwritten function a different name (not the same rename as in the super class). This causes an error on an invokevirtual because the this-pointer is of the wrong class.
Bug was not present in version “5.2.1”
(Compiler: Eclipse)
Here the output of my test script (code and binaries attachted):
Calling proguard
#############################
ProGuard, version 5.3.3
Reading input...
Reading program jar [D:\tmp_m\pg-bug\bintemp2.jar]
Reading library jar [C:\Program Files\Java\jdk1.8.0_92\jre\lib\rt.jar]
Initializing...
Ignoring unused library classes...
Original number of library classes: 19741
Final number of library classes: 19741
Shrinking...
Removing unused program classes and class elements...
Original number of program classes: 6
Final number of program classes: 6
Inlining subroutines...
Obfuscating...
Preverifying...
Writing output...
Preparing output jar [D:\tmp_m\pg-bug\binobf.jar]
Copying resources from program jar [D:\tmp_m\pg-bug\bintemp2.jar]
Normal
#############################
xyz - 127 - 0
no sub
xyz - 127 - 0
no sub
xyz - 127 - 0
no sub
xyz - 127 - 0
no sub
Obfuscated
#############################
Exception in thread "main" java.lang.VerifyError: Bad access to protected data in invokevirtual
Exception Details:
Location:
test/B.a(Ltest/B$Y;Lx/a;)V @1: invokevirtual
Reason:
Type 'x/a' (current frame, stack[0]) is not assignable to 'test/B'
Current Frame:
bci: @1
flags: { }
locals: { 'test/B$Y', 'x/a' }
stack: { 'x/a' }
Bytecode:
0x0000000: 2bb6 0025 4d2c c600 5c2b b400 1502 a400
0x0000010: 542c 593a 06be 3605 0336 04a7 0040 1906
0x0000020: 1504 324e b200 0ebb 0006 592a b400 13b8
0x0000030: 0017 b700 1812 01b6 001b 2ab4 0012 b600
0x0000040: 1a12 01b6 001b 2db6 0024 b600 19b6 001c
0x0000050: b600 162a 2db8 001e 8404 0115 0415 05a1
0x0000060: ffbf b1
Stackmap Table:
full_frame(@30,{Object[#9],Top,Top,Top,Integer,Integer,Object[#3]},{})
same_frame(@91)
full_frame(@98,{},{})
at test.Main.main(Unknown Source)
Thanks for your report. There is a subtlety in B accessing the protected method A.getSub() with an instance that is not "this". It's okay when A is in the same package, but not when A is moved to a different package, even though B extends A. I'll have to look into the cause of the regression and a fix.
Any news? It still do not work in 6.0.1...
Last edit: Marcel Heckel 2018-03-15
Hi again,
I compared the difference between 5.2.1 and 6.0.1:
All members of the obfuscated class "x/a" are public in 5.2.1 and in version 6.0.1 the have the same visibiblity like the original (see new attachment).
So I think, restoring this behaviort of the obfuscator wourd resolve the bug...
Hi,
with version 6.0.2 it is working now. Thank you very much!