混淆导致VerifyError:需要一个堆栈映射框架 [英] Obfuscation causes VerifyError: Expecting a stackmap frame

查看:304
本文介绍了混淆导致VerifyError:需要一个堆栈映射框架的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在使用最新的JDK 7(u45)和ProGuard版本4.10

We are using latest JDK 7 (u45) and ProGuard Version 4.10

在混淆后,最近启动发行失败,并出现以下错误:

Lately starting our distribution fails, after obfuscating it, with the following error:

Exception in thread "main" java.lang.VerifyError: Expecting a stackmap frame at
branch target 155
Exception Details:
  Location:
    com/bla/bla/service/ioc/SpringBootstrap.c()V @0: getstatic
  Reason:
    Expected stackmap frame at this location.
  Bytecode:
    0000000: b200 73b6 008b 9900 82b2 0073 b800 933b
    0000010: 1a99 0074 b200 73b6 008d 9900 6bb2 0074
    0000020: 1221 b600 cfb8 0092 4c2b b600 9c12 1db9
    ...
  Exception Handler Table:
    bci [0, 152] => handler: 155

        at java.lang.Class.getDeclaredMethods0(Native Method)
        at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
        at java.lang.Class.getMethod0(Unknown Source)
        at java.lang.Class.getMethod(Unknown Source)
        at sun.launcher.LauncherHelper.getMainMethod(Unknown Source)
        at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)

我在StackOverflow上找到了关于此主题的一些讨论,例如

I found several discussions about this topic on StackOverflow, like

  • java-lang-verifyerror-expecting-a-stackmap-frame-at-branch-target-jdk-1-7
  • java-lang-verifyerror-expecting-a-stackmap-frame
  • understanding-how-to-resolve-inconsistent-stackmap-frames-exception
  • java-7-inconsistent-stackmap-frames-need-help-understanding-why-solution-wor

据我了解,java 7使用更严格的验证,并为类引入了堆栈映射以验证代码.因此,在混淆过程中,此映射似乎已损坏,因为当我使用proguard对项目进行混淆时,只会发生此异常.

From what I understood is, that java 7 uses a stricter verification and introduced a stack map for classes to verify the code. So somehow during my obfuscation process this map seems to get corrupted, since only this exception occurs, when I obfuscate my project with proguard.

使用 -XX:-UseSplitVerifier 禁用验证并启动生成的jar会有所帮助,但我不确定是否应该以这种方式处理此问题.

Disabling the verification with -XX:-UseSplitVerifier and starting the builded jar helps, but im not really sure if that should be the way handling this issue.

所以我想知道其他人是否有类似错误?或者,如果有人甚至知道解决此问题的特定方法,例如通过调整混淆过程的Proguard密码来解决?

So I wonder if anyone else had a simular error? Or if anyone might even knows a specific way to solve this, for example by adjusting the proguard konfiguration for the obfuscation process?

推荐答案

我假设您不是指定-dontpreverify?该选项几乎肯定会导致这些错误,因为它将阻止ProGuard更新StackMapTable属性.该属性在Java 6中是可选的,但在Java 7中是必需的.

I assume you are not specifying -dontpreverify? That option will almost certainly lead to these errors, since it will stop ProGuard from updating the StackMapTable attribute. The attribute was optional in Java 6, but it is required in Java 7.

您仍然可以尝试ProGuard 4.11的Beta版,但不太可能在这里有所作为.如果您将处理过的课程文件邮寄给我,我会对其进行调查.

You could still try a beta version of ProGuard 4.11, but it is unlikely that it makes a difference here. If you mail me the processed class file, I'll look into it.

(我是ProGuard的开发人员)

(I am the developer of ProGuard)

这篇关于混淆导致VerifyError:需要一个堆栈映射框架的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆