Fixes a bug in ASM where invalid input LVT entries can translate into negative length output LVT entries, which causes a ClassFormatError when the JVM tries to load it.
See: http://forge.objectweb.org/tracker/?func=detail&atid=100023&aid=310932&group_id=23
The change simply omits any LVT entries with unresolved (and thus, invalid) start or end labels.
Review by: tobyr (postmortem)
git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@3621 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/dev/core/src/com/google/gwt/dev/asm/MethodWriter.java b/dev/core/src/com/google/gwt/dev/asm/MethodWriter.java
index e38767a..599b07b 100644
--- a/dev/core/src/com/google/gwt/dev/asm/MethodWriter.java
+++ b/dev/core/src/com/google/gwt/dev/asm/MethodWriter.java
@@ -1163,26 +1163,30 @@
final Label end,
final int index)
{
- if (signature != null) {
- if (localVarType == null) {
- localVarType = new ByteVector();
+ // GOOGLE: skip debug info if either label is unresolved.
+ if (((start.status & labels.RESOLVED) != 0)
+ && ((end.status & labels.RESOLVED) != 0)) {
+ if (signature != null) {
+ if (localVarType == null) {
+ localVarType = new ByteVector();
+ }
+ ++localVarTypeCount;
+ localVarType.putShort(start.position)
+ .putShort(end.position - start.position)
+ .putShort(cw.newUTF8(name))
+ .putShort(cw.newUTF8(signature))
+ .putShort(index);
}
- ++localVarTypeCount;
- localVarType.putShort(start.position)
+ if (localVar == null) {
+ localVar = new ByteVector();
+ }
+ ++localVarCount;
+ localVar.putShort(start.position)
.putShort(end.position - start.position)
.putShort(cw.newUTF8(name))
- .putShort(cw.newUTF8(signature))
+ .putShort(cw.newUTF8(desc))
.putShort(index);
}
- if (localVar == null) {
- localVar = new ByteVector();
- }
- ++localVarCount;
- localVar.putShort(start.position)
- .putShort(end.position - start.position)
- .putShort(cw.newUTF8(name))
- .putShort(cw.newUTF8(desc))
- .putShort(index);
if (compute != NOTHING) {
// updates max locals
char c = desc.charAt(0);