[MC-6699] Reading Bytes in Minecraft code has a possible flaw Created: 10/Jan/13 Updated: 10/Jan/13 Resolved: 10/Jan/13 |
|
| Status: | Resolved |
| Project: | Minecraft: Java Edition |
| Component/s: | None |
| Affects Version/s: | Minecraft 1.4.6, Minecraft 1.4.7, Snapshot 13w01b |
| Fix Version/s: | Snapshot 13w02a |
| Type: | Bug | ||
| Reporter: | David Herberth | Assignee: | [Mojang] Nathan Adams |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Confirmation Status: | Unconfirmed |
| Description |
|
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) |