Reading Bytes in Minecraft code has a possible flaw
I used MCP to debug a problem with my client, I stumbled across this code in Packet.class:
public static byte[] readBytesFromStream(DataInputStream par0DataInputStream) throws IOException { short var1 = par0DataInputStream.readShort(); if (var1 < 0) { throw new IOException("Key was smaller than nothing! Weird key!"); } else { byte[] var2 = new byte[var1]; par0DataInputStream.read(var2); return var2; } }
The problem lies in `par0DataInputStream.read(var2);`, it reads up to var2-bytes but not exactly var2-bytes.
(already fixed by Dinnerbone, submitting it for the sake of completeness)
2013-01-10, 02:20 AM
2013-01-10, 02:20 AM
2013-01-10, 02:20 AM
0
1