Skip to content

Commit 6c9a876

Browse files
committed
Fix missing IFNULL check in removeInvalidInstructions
1 parent efa05b2 commit 6c9a876

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

core/src/main/java/software/coley/cafedude/transform/IllegalStrippingTransformer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ protected void removeInstructionReinterpretation(@Nonnull CodeAttribute code, in
354354
// checkInvalidJumpUpTo(code, currentOffset);
355355
// checkInvalidJumpFrom(code, reinterpretedBlockOffset);
356356

357-
//
357+
// Append trailing instructions to make sure we don't fall off the end of the method.
358358
Instruction lastReinterpretedBlockInsn = reinrerpreted.get(reinrerpreted.size() - 1);
359359
if (isTerminalOrAlwaysTakeFlowControl(lastReinterpretedBlockInsn)) {
360360
// Execution naturally ends, no need to make changes
@@ -417,7 +417,7 @@ protected void removeInvalidInstructions(@Nonnull CodeAttribute code) {
417417
int op = instruction.getOpcode();
418418

419419
// Jumps that go out of bounds of the method
420-
if (((op >= IFEQ && op <= JSR) || (op == GOTO_W || op == JSR_W)) && instruction instanceof IntOperandInstruction jump) {
420+
if (isBranch(instruction) && instruction instanceof IntOperandInstruction jump) {
421421
int jumpOffset = code.computeOffsetOf(jump) + jump.getOperand();
422422
if (jumpOffset > maxPc || jumpOffset < 0) {
423423
int size = instruction.computeSize();

0 commit comments

Comments
 (0)