Skip to content

Commit

Permalink
Merge upstream
Browse files Browse the repository at this point in the history
  • Loading branch information
corretto-github-robot committed Feb 9, 2024
2 parents a39b20c + 4a69ad2 commit bbc336d
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions jdk/src/share/native/common/check_code.c
Original file line number Diff line number Diff line change
Expand Up @@ -1684,12 +1684,13 @@ static int instruction_length(unsigned char *iptr, unsigned char *end)
switch (instruction) {
case JVM_OPC_tableswitch: {
int *lpc = (int *)UCALIGN(iptr + 1);
int64_t low, high, index;
if (lpc + 2 >= (int *)end) {
return -1; /* do not read pass the end */
}
int64_t low = _ck_ntohl(lpc[1]);
int64_t high = _ck_ntohl(lpc[2]);
int64_t index = high - low;
low = _ck_ntohl(lpc[1]);
high = _ck_ntohl(lpc[2]);
index = high - low;
// The value of low must be less than or equal to high - i.e. index >= 0
if ((index < 0) || (index > 65535)) {
return -1; /* illegal */
Expand Down

0 comments on commit bbc336d

Please sign in to comment.