mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-11-07 17:36:07 +00:00
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:
parent
550a1c060c
commit
851f634fae
1 changed files with 2 additions and 1 deletions
|
|
@ -267,6 +267,7 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
/// <returns>The integer</returns>
|
/// <returns>The integer</returns>
|
||||||
public int ReadNextVarInt(List<byte> cache)
|
public int ReadNextVarInt(List<byte> cache)
|
||||||
{
|
{
|
||||||
|
string rawData = BitConverter.ToString(cache.ToArray());
|
||||||
int i = 0;
|
int i = 0;
|
||||||
int j = 0;
|
int j = 0;
|
||||||
int k = 0;
|
int k = 0;
|
||||||
|
|
@ -274,7 +275,7 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
{
|
{
|
||||||
k = ReadNextByte(cache);
|
k = ReadNextByte(cache);
|
||||||
i |= (k & 0x7F) << j++ * 7;
|
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;
|
if ((k & 0x80) != 128) break;
|
||||||
}
|
}
|
||||||
return i;
|
return i;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue