https://github.com/ORelio/Minecraft-Console-Client/issues/811: report the raw packet data whenever we get a VarInt too big

This commit is contained in:
TheSnoozer 2019-10-03 09:38:49 +02:00
parent 550a1c060c
commit 851f634fae

View file

@ -267,6 +267,7 @@ namespace MinecraftClient.Protocol.Handlers
/// <returns>The integer</returns>
public int ReadNextVarInt(List<byte> cache)
{
string rawData = BitConverter.ToString(cache.ToArray());
int i = 0;
int j = 0;
int k = 0;
@ -274,7 +275,7 @@ namespace MinecraftClient.Protocol.Handlers
{
k = ReadNextByte(cache);
i |= (k & 0x7F) << j++ * 7;
if (j > 5) throw new OverflowException("VarInt too big");
if (j > 5) throw new OverflowException("VarInt too big " + rawData);
if ((k & 0x80) != 128) break;
}
return i;