fix for nasty bug in decoding dup2_x2

This commit is contained in:
Julian Dolby 2018-05-31 19:32:02 -04:00
parent 400b2055ce
commit 196f7cb153
1 changed files with 4 additions and 3 deletions

View File

@ -513,10 +513,11 @@ public abstract class Decoder implements Constants {
case OP_dup2_x1: case OP_dup2_x1:
i = DupInstruction.make(elemCount(stackWords, stackLen - 1), 1); i = DupInstruction.make(elemCount(stackWords, stackLen - 1), 1);
break; break;
case OP_dup2_x2: case OP_dup2_x2: {
i = DupInstruction.make(elemCount(stackWords, stackLen - 1), elemCount(stackWords, stackLen - 2)); int twoDown = elemCount(stackWords, stackLen - 1);
i = DupInstruction.make(twoDown, elemCount(stackWords, stackLen - twoDown - 1));
break; break;
case OP_iinc: { } case OP_iinc: {
int v = wide ? decodeUShort(index) : (code[index] & 0xFF); int v = wide ? decodeUShort(index) : (code[index] & 0xFF);
int c = wide ? decodeShort(index + 2) : code[index + 1]; int c = wide ? decodeShort(index + 2) : code[index + 1];