Mon, 25 Mar 2013 08:37:28 -0400
8010667: Non-zero padding is not allowed in splitverifier for tableswitch/lookupswitch instructions.
Summary: Don't check the padding bits if class file version is >= 51.
Reviewed-by: kvn, dholmes, coleenp
src/share/vm/classfile/verifier.cpp | file | annotate | diff | comparison | revisions |
1.1 --- a/src/share/vm/classfile/verifier.cpp Sun Mar 24 09:21:37 2013 +0100 1.2 +++ b/src/share/vm/classfile/verifier.cpp Mon Mar 25 08:37:28 2013 -0400 1.3 @@ -61,8 +61,9 @@ 1.4 # include "bytes_ppc.hpp" 1.5 #endif 1.6 1.7 -#define NOFAILOVER_MAJOR_VERSION 51 1.8 -#define STATIC_METHOD_IN_INTERFACE_MAJOR_VERSION 52 1.9 +#define NOFAILOVER_MAJOR_VERSION 51 1.10 +#define NONZERO_PADDING_BYTES_IN_SWITCH_MAJOR_VERSION 51 1.11 +#define STATIC_METHOD_IN_INTERFACE_MAJOR_VERSION 52 1.12 1.13 // Access to external entry for VerifyClassCodes - old byte code verifier 1.14 1.15 @@ -2027,16 +2028,19 @@ 1.16 address bcp = bcs->bcp(); 1.17 address aligned_bcp = (address) round_to((intptr_t)(bcp + 1), jintSize); 1.18 1.19 - // 4639449 & 4647081: padding bytes must be 0 1.20 - u2 padding_offset = 1; 1.21 - while ((bcp + padding_offset) < aligned_bcp) { 1.22 - if(*(bcp + padding_offset) != 0) { 1.23 - verify_error(ErrorContext::bad_code(bci), 1.24 - "Nonzero padding byte in lookswitch or tableswitch"); 1.25 - return; 1.26 + if (_klass->major_version() < NONZERO_PADDING_BYTES_IN_SWITCH_MAJOR_VERSION) { 1.27 + // 4639449 & 4647081: padding bytes must be 0 1.28 + u2 padding_offset = 1; 1.29 + while ((bcp + padding_offset) < aligned_bcp) { 1.30 + if(*(bcp + padding_offset) != 0) { 1.31 + verify_error(ErrorContext::bad_code(bci), 1.32 + "Nonzero padding byte in lookswitch or tableswitch"); 1.33 + return; 1.34 + } 1.35 + padding_offset++; 1.36 } 1.37 - padding_offset++; 1.38 } 1.39 + 1.40 int default_offset = (int) Bytes::get_Java_u4(aligned_bcp); 1.41 int keys, delta; 1.42 current_frame->pop_stack(