From 4f6bc0cc73bc90f505a854e799fc8712e6edd751 Mon Sep 17 00:00:00 2001 From: Kelly O'Hair Date: Fri, 26 Jun 2009 21:52:47 -0700 Subject: [PATCH] 6855180: Fix classfile version check in java_crw_demo Reviewed-by: jjg --- .../share/demo/jvmti/java_crw_demo/java_crw_demo.c | 11 +++++++---- jdk/src/share/javavm/export/classfile_constants.h | 4 ++++ 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/jdk/src/share/demo/jvmti/java_crw_demo/java_crw_demo.c b/jdk/src/share/demo/jvmti/java_crw_demo/java_crw_demo.c index 5781ffe2494..6d43d9baa90 100644 --- a/jdk/src/share/demo/jvmti/java_crw_demo/java_crw_demo.c +++ b/jdk/src/share/demo/jvmti/java_crw_demo/java_crw_demo.c @@ -2227,7 +2227,8 @@ inject_class(struct CrwClassImage *ci, CrwCpoolIndex this_class; CrwCpoolIndex super_class; unsigned magic; - unsigned classfileVersion; + unsigned classfileMajorVersion; + unsigned classfileMinorVersion; unsigned interface_count; CRW_ASSERT_CI(ci); @@ -2258,10 +2259,12 @@ inject_class(struct CrwClassImage *ci, } /* minor version number not used */ - (void)copyU2(ci); + classfileMinorVersion = copyU2(ci); /* major version number not used */ - classfileVersion = copyU2(ci); - CRW_ASSERT(ci, classfileVersion <= 50); /* Mustang class files or less */ + classfileMajorVersion = copyU2(ci); + CRW_ASSERT(ci, (classfileMajorVersion <= JVM_CLASSFILE_MAJOR_VERSION) || + ((classfileMajorVersion == JVM_CLASSFILE_MAJOR_VERSION) && + (classfileMinorVersion <= JVM_CLASSFILE_MINOR_VERSION))); cpool_setup(ci); diff --git a/jdk/src/share/javavm/export/classfile_constants.h b/jdk/src/share/javavm/export/classfile_constants.h index d225fa4ce7e..c3ae4cd412a 100644 --- a/jdk/src/share/javavm/export/classfile_constants.h +++ b/jdk/src/share/javavm/export/classfile_constants.h @@ -30,6 +30,10 @@ extern "C" { #endif +/* Classfile version number for this information */ +#define JVM_CLASSFILE_MAJOR_VERSION 51 +#define JVM_CLASSFILE_MINOR_VERSION 0 + /* Flags */ enum {