8371352: [8u] Fix VS2010 build issue in check_code.c

Reviewed-by: phh, andrew
This commit is contained in:
Zdenek Zambersky 2025-11-11 11:36:01 +00:00
parent a8cf6db481
commit 6526a275b8

View File

@ -1161,10 +1161,11 @@ verify_opcode_operands(context_type *context, unsigned int inumber, int offset)
case JVM_OPC_if_acmpeq: case JVM_OPC_if_acmpne:
case JVM_OPC_goto: {
/* Set the ->operand to be the instruction number of the target. */
int jump = (((signed char)(code[offset+1])) << 8) + code[offset+2];
int jump, target;
jump = (((signed char)(code[offset+1])) << 8) + code[offset+2];
if (!isLegalOffset(context, offset, jump))
CCerror(context, "Illegal target of jump or branch");
int target = offset + jump;
target = offset + jump;
this_idata->operand.i = code_data[target];
break;
}
@ -1175,12 +1176,13 @@ verify_opcode_operands(context_type *context, unsigned int inumber, int offset)
/* FALLTHROUGH */
case JVM_OPC_goto_w: {
/* Set the ->operand to be the instruction number of the target. */
int jump = (((signed char)(code[offset+1])) << 24) +
int jump, target;
jump = (((signed char)(code[offset+1])) << 24) +
(code[offset+2] << 16) + (code[offset+3] << 8) +
(code[offset + 4]);
if (!isLegalOffset(context, offset, jump))
CCerror(context, "Illegal target of jump or branch");
int target = offset + jump;
target = offset + jump;
this_idata->operand.i = code_data[target];
break;
}
@ -1193,6 +1195,7 @@ verify_opcode_operands(context_type *context, unsigned int inumber, int offset)
int *saved_operand;
int keys;
int k, delta;
int jump, target;
if (context->major_version < NONZERO_PADDING_BYTES_IN_SWITCH_MAJOR_VERSION) {
/* 4639449, 4647081: Padding bytes must be zero. */
@ -1219,10 +1222,10 @@ verify_opcode_operands(context_type *context, unsigned int inumber, int offset)
}
}
saved_operand = NEW(int, keys + 2);
int jump = _ck_ntohl(lpc[0]);
jump = _ck_ntohl(lpc[0]);
if (!isLegalOffset(context, offset, jump))
CCerror(context, "Illegal default target in switch");
int target = offset + jump;
target = offset + jump;
saved_operand[keys + 1] = code_data[target];
for (k = keys, lptr = &lpc[3]; --k >= 0; lptr += delta) {
jump = _ck_ntohl(lptr[0]);
@ -1765,8 +1768,9 @@ isLegalOffset(context_type *context, int bci, int offset)
int *code_data = context->code_data;
int max_offset = 65535; // JVMS 4.11
int min_offset = -65535;
int target;
if (offset < min_offset || offset > max_offset) return JNI_FALSE;
int target = bci + offset;
target = bci + offset;
return (target >= 0 && target < code_length && code_data[target] >= 0);
}