提交 c12d4920 编写于 作者: C coleenp

7154889: Non-zero padding is still not allowed in the tableswitch/lookupswitch instructions.

Summary: Do not check that the padding bytes are zero if class file format version >=51.
Reviewed-by: dholmes, coleenp, mullan, kvn
Contributed-by: harold.seigel@oracle.com
上级 ca3b533c
...@@ -206,6 +206,8 @@ enum { ...@@ -206,6 +206,8 @@ enum {
#define LDC_METHOD_HANDLE_MAJOR_VERSION 51 #define LDC_METHOD_HANDLE_MAJOR_VERSION 51
#define NONZERO_PADDING_BYTES_IN_SWITCH_MAJOR_VERSION 51
#define STATIC_METHOD_IN_INTERFACE_MAJOR_VERSION 52 #define STATIC_METHOD_IN_INTERFACE_MAJOR_VERSION 52
#define ALLOC_STACK_SIZE 16 /* big enough */ #define ALLOC_STACK_SIZE 16 /* big enough */
...@@ -1146,6 +1148,8 @@ verify_opcode_operands(context_type *context, unsigned int inumber, int offset) ...@@ -1146,6 +1148,8 @@ verify_opcode_operands(context_type *context, unsigned int inumber, int offset)
int *saved_operand; int *saved_operand;
int keys; int keys;
int k, delta; int k, delta;
if (context->major_version < NONZERO_PADDING_BYTES_IN_SWITCH_MAJOR_VERSION) {
/* 4639449, 4647081: Padding bytes must be zero. */ /* 4639449, 4647081: Padding bytes must be zero. */
unsigned char* bptr = (unsigned char*) (code + offset + 1); unsigned char* bptr = (unsigned char*) (code + offset + 1);
for (; bptr < (unsigned char*)lpc; bptr++) { for (; bptr < (unsigned char*)lpc; bptr++) {
...@@ -1153,6 +1157,7 @@ verify_opcode_operands(context_type *context, unsigned int inumber, int offset) ...@@ -1153,6 +1157,7 @@ verify_opcode_operands(context_type *context, unsigned int inumber, int offset)
CCerror(context, "Non zero padding bytes in switch"); CCerror(context, "Non zero padding bytes in switch");
} }
} }
}
if (opcode == JVM_OPC_tableswitch) { if (opcode == JVM_OPC_tableswitch) {
keys = _ck_ntohl(lpc[2]) - _ck_ntohl(lpc[1]) + 1; keys = _ck_ntohl(lpc[2]) - _ck_ntohl(lpc[1]) + 1;
delta = 1; delta = 1;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册