6855180: Fix classfile version check in java_crw_demo

Reviewed-by: jjg
This commit is contained in:
Kelly O'Hair 2009-06-26 21:52:47 -07:00
parent 272d82ec23
commit 4f6bc0cc73
2 changed files with 11 additions and 4 deletions

View File

@ -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);

View File

@ -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 {