diff --git a/src/hotspot/share/classfile/verifier.cpp b/src/hotspot/share/classfile/verifier.cpp index 95e5f55c172..1e9bdcc682d 100644 --- a/src/hotspot/share/classfile/verifier.cpp +++ b/src/hotspot/share/classfile/verifier.cpp @@ -2037,7 +2037,8 @@ void ClassVerifier::verify_cp_type( verify_cp_index(bci, cp, index, CHECK_VERIFY(this)); unsigned int tag = cp->tag_at(index).value(); - if ((types & (1 << tag)) == 0) { + // tags up to JVM_CONSTANT_ExternalMax are verifiable and valid for shift op + if (tag > JVM_CONSTANT_ExternalMax || (types & (1 << tag)) == 0) { verify_error(ErrorContext::bad_cp_index(bci, index), "Illegal type at constant pool entry %d in class %s", index, cp->pool_holder()->external_name());