comparison src/share/demo/jvmti/java_crw_demo/java_crw_demo.c @ 1388:dd20c662d463

6855180: Fix classfile version check in java_crw_demo Reviewed-by: jjg
author ohair
date Fri, 26 Jun 2009 21:52:47 -0700
parents 37a05a11f281
children d3a08f8c3c86
comparison
equal deleted inserted replaced
0:1363a8e067e9 1:d221cda3a2ba
2225 { 2225 {
2226 CrwConstantPoolEntry cs; 2226 CrwConstantPoolEntry cs;
2227 CrwCpoolIndex this_class; 2227 CrwCpoolIndex this_class;
2228 CrwCpoolIndex super_class; 2228 CrwCpoolIndex super_class;
2229 unsigned magic; 2229 unsigned magic;
2230 unsigned classfileVersion; 2230 unsigned classfileMajorVersion;
2231 unsigned classfileMinorVersion;
2231 unsigned interface_count; 2232 unsigned interface_count;
2232 2233
2233 CRW_ASSERT_CI(ci); 2234 CRW_ASSERT_CI(ci);
2234 CRW_ASSERT(ci, buf!=NULL); 2235 CRW_ASSERT(ci, buf!=NULL);
2235 CRW_ASSERT(ci, buf_len!=0); 2236 CRW_ASSERT(ci, buf_len!=0);
2256 if ( magic != 0xCAFEBABE ) { 2257 if ( magic != 0xCAFEBABE ) {
2257 return (long)0; 2258 return (long)0;
2258 } 2259 }
2259 2260
2260 /* minor version number not used */ 2261 /* minor version number not used */
2261 (void)copyU2(ci); 2262 classfileMinorVersion = copyU2(ci);
2262 /* major version number not used */ 2263 /* major version number not used */
2263 classfileVersion = copyU2(ci); 2264 classfileMajorVersion = copyU2(ci);
2264 CRW_ASSERT(ci, classfileVersion <= 50); /* Mustang class files or less */ 2265 CRW_ASSERT(ci, (classfileMajorVersion <= JVM_CLASSFILE_MAJOR_VERSION) ||
2266 ((classfileMajorVersion == JVM_CLASSFILE_MAJOR_VERSION) &&
2267 (classfileMinorVersion <= JVM_CLASSFILE_MINOR_VERSION)));
2265 2268
2266 cpool_setup(ci); 2269 cpool_setup(ci);
2267 2270
2268 ci->access_flags = copyU2(ci); 2271 ci->access_flags = copyU2(ci);
2269 if ( skip_class(ci->access_flags) ) { 2272 if ( skip_class(ci->access_flags) ) {