jdk/src/share/classes/com/sun/java/util/jar/pack/ConstantPool.java

Print this page
rev 5678 : 7186957: Improve Pack200 data validation
Reviewed-by: jrose, jjh, mschoene

@@ -1051,10 +1051,12 @@
             return ix;
         }
 
         /** Index of all CP entries of a given tag and class. */
         public Index getMemberIndex(byte tag, ClassEntry classRef) {
+            if (classRef == null)
+                throw new RuntimeException("missing class reference for " + tagName(tag));
             if (indexByTagAndClass == null)
                 indexByTagAndClass = new Index[CONSTANT_Limit][];
             Index allClasses =  getIndexByTag(CONSTANT_Class);
             Index[] perClassIndexes = indexByTagAndClass[tag];
             if (perClassIndexes == null) {