Author: markt
Date: Wed Sep 10 21:30:03 2014
New Revision: 1624139

URL: http://svn.apache.org/r1624139
Log:
Some constant types are never used so they can be swallowed which means 
returning null. That could trigger an NPE so make sure it doesn't.

Modified:
    tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantPool.java

Modified: 
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantPool.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantPool.java?rev=1624139&r1=1624138&r2=1624139&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantPool.java 
(original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantPool.java 
Wed Sep 10 21:30:03 2014
@@ -49,7 +49,6 @@ public class ConstantPool implements Clo
      * @throws ClassFormatException
      */
     ConstantPool(DataInputStream file) throws IOException, 
ClassFormatException {
-        byte tag;
         constant_pool_count = file.readUnsignedShort();
         constant_pool = new Constant[constant_pool_count];
         /* constant_pool[0] is unused by the compiler and may be used freely
@@ -64,9 +63,11 @@ public class ConstantPool implements Clo
              *
              * Thus we have to increment the index counter.
              */
-            tag = constant_pool[i].getTag();
-            if ((tag == Constants.CONSTANT_Double) || (tag == 
Constants.CONSTANT_Long)) {
-                i++;
+            if (constant_pool[i] != null) {
+                byte tag = constant_pool[i].getTag();
+                if ((tag == Constants.CONSTANT_Double) || (tag == 
Constants.CONSTANT_Long)) {
+                    i++;
+                }
             }
         }
     }



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to