From 56a50c60b560f220dfdae33f35813af68bae7be4 Mon Sep 17 00:00:00 2001 From: Andrew Steinborn Date: Sun, 9 Sep 2018 15:05:27 -0400 Subject: [PATCH] Add missing readable check --- .../proxy/protocol/netty/MinecraftVarintFrameDecoder.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/proxy/src/main/java/com/velocitypowered/proxy/protocol/netty/MinecraftVarintFrameDecoder.java b/proxy/src/main/java/com/velocitypowered/proxy/protocol/netty/MinecraftVarintFrameDecoder.java index ec2f9ded7..136204fa2 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/protocol/netty/MinecraftVarintFrameDecoder.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/protocol/netty/MinecraftVarintFrameDecoder.java @@ -20,6 +20,11 @@ public class MinecraftVarintFrameDecoder extends ByteToMessageDecoder { byte[] lenBuf = new byte[3]; for (int i = 0; i < lenBuf.length; i++) { + if (!in.isReadable()) { + in.resetReaderIndex(); + return; + } + lenBuf[i] = in.readByte(); if (lenBuf[i] > 0) { int packetLength = ProtocolUtils.readVarInt(Unpooled.wrappedBuffer(lenBuf));