Skip to content

Commit

Permalink
Fix beacon crash server (#1490)
Browse files Browse the repository at this point in the history
  • Loading branch information
IzzelAliz committed Sep 19, 2024
1 parent 9f8f2da commit 90ea5f9
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import org.objectweb.asm.tree.ClassNode;
import org.objectweb.asm.tree.FieldInsnNode;
import org.objectweb.asm.tree.FieldNode;
import org.objectweb.asm.tree.FrameNode;
import org.objectweb.asm.tree.InsnList;
import org.objectweb.asm.tree.InsnNode;
import org.objectweb.asm.tree.JumpInsnNode;
Expand Down Expand Up @@ -72,7 +73,9 @@ private boolean tryImplement(ClassNode node) {
list.add(new MethodInsnNode(Opcodes.INVOKEVIRTUAL, Type.getInternalName(Integer.class), "intValue", "()I", false));
list.add(new InsnNode(Opcodes.IRETURN));
list.add(labelNode);
list.add(new FrameNode(Opcodes.F_SAME1, 0, null, 1, new Object[]{Type.getInternalName(Integer.class)}));
list.add(new InsnNode(Opcodes.POP));
stackLimitMethod.maxStack = Math.max(2, stackLimitMethod.maxStack);
stackLimitMethod.instructions.insert(list);
{
MethodNode methodNode = new MethodNode(Opcodes.ACC_PUBLIC | Opcodes.ACC_SYNTHETIC, "setMaxStackSize", "(I)V", null, null);
Expand All @@ -83,6 +86,8 @@ private boolean tryImplement(ClassNode node) {
insnList.add(new FieldInsnNode(Opcodes.PUTFIELD, node.name, maxStack.name, maxStack.desc));
insnList.add(new InsnNode(Opcodes.RETURN));
methodNode.instructions = insnList;
methodNode.maxLocals = 2;
methodNode.maxStack = 2;
node.methods.add(methodNode);
}
return true;
Expand Down

0 comments on commit 90ea5f9

Please sign in to comment.