Handle partially sent varints better
This commit is contained in:
@@ -20,7 +20,8 @@ public class MinecraftVarintFrameDecoder extends ByteToMessageDecoder {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!reader.successfulDecode) {
|
||||
if (reader.successfulDecode) {
|
||||
if (reader.readVarint < 0) {
|
||||
throw BAD_LENGTH_CACHED;
|
||||
}
|
||||
|
||||
@@ -33,6 +34,13 @@ public class MinecraftVarintFrameDecoder extends ByteToMessageDecoder {
|
||||
reader.reset();
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
boolean tooBig = reader.bytesRead > 3;
|
||||
reader.reset();
|
||||
if (tooBig) {
|
||||
throw BAD_LENGTH_CACHED;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user