Author: [EMAIL PROTECTED]
Date: Thu Sep  4 15:12:50 2008
New Revision: 3621

Modified:
    trunk/dev/core/src/com/google/gwt/dev/asm/MethodWriter.java

Log:
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 (TBR)


Modified: trunk/dev/core/src/com/google/gwt/dev/asm/MethodWriter.java
==============================================================================
--- trunk/dev/core/src/com/google/gwt/dev/asm/MethodWriter.java (original)
+++ trunk/dev/core/src/com/google/gwt/dev/asm/MethodWriter.java Thu Sep  4  
15:12:50 2008
@@ -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);

--~--~---------~--~----~------------~-------~--~----~
http://groups.google.com/group/Google-Web-Toolkit-Contributors
-~----------~----~----~----~------~----~------~--~---

Reply via email to