Program: 150333
Project: 150333
Buggy source:
protected void handlePacket(byte packetId) throws IOException {
switch (packetId) {
case 0x2:
    readUTF16();
  login();
break;
case 0x1:
in.readInt();
readUTF16();
in.readLong();
in.readInt();
position.dimension=Dimension.get(in.readByte());
in.readByte();
in.readByte();
in.readByte();
break;
case 0x0d:
double x=in.readDouble();
double stance=in.readDouble();
double y=in.readDouble();
double z=in.readDouble();
float yaw=in.readFloat();
float pitch=in.readFloat();
boolean onGround=in.readBoolean();
position.updatePosition(x,y,z,stance);
position.updateLook(yaw,pitch);
position.updateGround(onGround);
if (!ready) {
sendPosition();
ready();
}
 else if (dead) {
sendPosition();
dead=false;
}
positionUpdate();
break;
case 0x0b:
double x2=in.readDouble();
double stance2=in.readDouble();
double y2=in.readDouble();
double z2=in.readDouble();
boolean onGround2=in.readBoolean();
position.updatePosition(x2,y2,z2,stance2);
position.updateGround(onGround2);
positionUpdate();
break;
case (byte)0xff:
String reason=readUTF16();
error(reason);
break;
case 0x00:
keepAlive(in.readInt());
break;
case 0x03:
readUTF16();
break;
case 0x04:
in.readLong();
break;
case 0x05:
in.readInt();
in.readShort();
in.readShort();
in.readShort();
break;
case 0x06:
readNBytes(12);
break;
case 0x07:
in.readInt();
in.readInt();
in.readBoolean();
in.readBoolean();
break;
case 0x08:
health=in.readShort();
in.readShort();
in.readFloat();
if (health <= 0) {
dead=true;
respawn();
}
break;
case 0x09:
position.dimension=Dimension.get(in.readByte());
in.readByte();
in.readByte();
in.readShort();
in.readLong();
break;
case 0x0a:
in.readByte();
break;
case 0x0c:
readNBytes(9);
break;
case 0x0e:
in.readByte();
in.readInt();
in.readByte();
in.readInt();
in.readByte();
break;
case 0x0f:
in.readInt();
in.readByte();
in.readInt();
in.readByte();
readItem();
break;
case 0x10:
readNBytes(2);
break;
case 0x11:
readNBytes(14);
break;
case 0x12:
readNBytes(5);
break;
case 0x13:
in.readInt();
in.readByte();
break;
case 0x14:
in.readInt();
readUTF16();
readNBytes(16);
break;
case 0x15:
readNBytes(24);
break;
case 0x16:
readNBytes(8);
break;
case 0x17:
in.readInt();
in.readByte();
in.readInt();
in.readInt();
in.readInt();
int flag=in.readInt();
if (flag > 0) {
in.readShort();
in.readShort();
in.readShort();
}
break;
case 0x18:
in.readInt();
in.readByte();
in.readInt();
in.readInt();
in.readInt();
in.readByte();
in.readByte();
readUnknownBlob();
break;
case 0x19:
in.readInt();
readUTF16();
in.readInt();
in.readInt();
in.readInt();
in.readInt();
break;
case 0x1a:
in.readInt();
in.readInt();
in.readInt();
in.readInt();
in.readShort();
break;
case 0x1c:
readNBytes(10);
break;
case 0x1d:
readNBytes(4);
break;
case 0x1e:
readNBytes(4);
break;
case 0x1f:
readNBytes(7);
break;
case 0x20:
readNBytes(6);
break;
case 0x21:
readNBytes(9);
break;
case 0x22:
readNBytes(18);
break;
case 0x26:
readNBytes(5);
break;
case 0x27:
readNBytes(8);
break;
case 0x28:
in.readInt();
readUnknownBlob();
break;
case 0x29:
in.readInt();
in.readByte();
in.readByte();
in.readShort();
break;
case 0x2a:
in.readInt();
in.readByte();
break;
case 0x2b:
in.readFloat();
in.readShort();
in.readShort();
break;
case 0x32:
readNBytes(9);
break;
case 0x33:
readNBytes(13);
int chunkSize=in.readInt();
readNBytes(chunkSize);
break;
case 0x34:
readNBytes(8);
short arraySize=in.readShort();
readNBytes(arraySize * 4);
break;
case 0x35:
in.readInt();
in.readByte();
in.readInt();
in.readByte();
in.readByte();
break;
case 0x36:
readNBytes(12);
break;
case 0x3c:
readNBytes(28);
int recordCount=in.readInt();
readNBytes(recordCount * 3);
break;
case 0x3d:
in.readInt();
in.readInt();
in.readByte();
in.readInt();
in.readInt();
break;
case 0x46:
readNBytes(2);
break;
case 0x47:
readNBytes(17);
break;
case 0x64:
in.readByte();
in.readByte();
readUTF16();
in.readByte();
break;
case 0x65:
in.readByte();
break;
case 0x66:
in.readByte();
in.readShort();
in.readByte();
in.readShort();
in.readBoolean();
readItem();
break;
case 0x67:
in.readByte();
in.readShort();
readItem();
break;
case 0x68:
in.readByte();
short count=in.readShort();
for (int c=0; c < count; ++c) {
readItem();
}
break;
case 0x69:
in.readByte();
in.readShort();
in.readShort();
break;
case 0x6a:
in.readByte();
in.readShort();
in.readByte();
break;
case 0x6b:
in.readShort();
readItem();
break;
case (byte)0x6c:
readNBytes(2);
break;
case (byte)0x82:
in.readInt();
in.readShort();
in.readInt();
readUTF16();
readUTF16();
readUTF16();
readUTF16();
break;
case (byte)0x83:
in.readShort();
in.readShort();
byte length=in.readByte();
readNBytes(0xff & length);
break;
case (byte)0xc8:
readNBytes(5);
break;
case (byte)0xc9:
readUTF16();
in.readBoolean();
in.readShort();
break;
case (byte)0xe6:
in.readInt();
in.readInt();
readNBytes(in.readInt() * 4);
readNBytes(in.readInt() * 4);
int sizeString=in.readInt();
for (int i=0; i < sizeString; i++) {
readNBytes(in.readInt());
}
break;
case (byte)0xfa:
readUTF16();
short arrayLength=in.readShort();
readNBytes(0xff & arrayLength);
break;
case (byte)0xfe:
break;
default :
error("String_Node_Str" + Integer.toHexString(packetId) + "String_Node_Str"+ Integer.toHexString(lastPacket));
}
lastPacket=packetId;
}

Fixed version (ground truth):
protected void handlePacket(byte packetId) throws IOException {
switch (packetId) {
case 0x2:
    readUTF16();
  login();
break;
case 0x1:
in.readInt();
readUTF16();
in.readLong();
readUTF16();
in.readInt();
position.dimension=Dimension.get(in.readByte());
in.readByte();
in.readByte();
in.readByte();
break;
case 0x0d:
double x=in.readDouble();
double stance=in.readDouble();
double y=in.readDouble();
double z=in.readDouble();
float yaw=in.readFloat();
float pitch=in.readFloat();
boolean onGround=in.readBoolean();
position.updatePosition(x,y,z,stance);
position.updateLook(yaw,pitch);
position.updateGround(onGround);
if (!ready) {
sendPosition();
ready();
}
 else if (dead) {
sendPosition();
dead=false;
}
positionUpdate();
break;
case 0x0b:
double x2=in.readDouble();
double stance2=in.readDouble();
double y2=in.readDouble();
double z2=in.readDouble();
boolean onGround2=in.readBoolean();
position.updatePosition(x2,y2,z2,stance2);
position.updateGround(onGround2);
positionUpdate();
break;
case (byte)0xff:
String reason=readUTF16();
error(reason);
break;
case 0x00:
keepAlive(in.readInt());
break;
case 0x03:
readUTF16();
break;
case 0x04:
in.readLong();
break;
case 0x05:
in.readInt();
in.readShort();
in.readShort();
in.readShort();
break;
case 0x06:
readNBytes(12);
break;
case 0x07:
in.readInt();
in.readInt();
in.readBoolean();
in.readBoolean();
break;
case 0x08:
health=in.readShort();
in.readShort();
in.readFloat();
if (health <= 0) {
dead=true;
respawn();
}
break;
case 0x09:
position.dimension=Dimension.get(in.readByte());
in.readByte();
in.readByte();
in.readShort();
in.readLong();
readUTF16();
break;
case 0x0a:
in.readByte();
break;
case 0x0c:
readNBytes(9);
break;
case 0x0e:
in.readByte();
in.readInt();
in.readByte();
in.readInt();
in.readByte();
break;
case 0x0f:
in.readInt();
in.readByte();
in.readInt();
in.readByte();
readItem();
break;
case 0x10:
readNBytes(2);
break;
case 0x11:
readNBytes(14);
break;
case 0x12:
readNBytes(5);
break;
case 0x13:
in.readInt();
in.readByte();
break;
case 0x14:
in.readInt();
readUTF16();
readNBytes(16);
break;
case 0x15:
readNBytes(24);
break;
case 0x16:
readNBytes(8);
break;
case 0x17:
in.readInt();
in.readByte();
in.readInt();
in.readInt();
in.readInt();
int flag=in.readInt();
if (flag > 0) {
in.readShort();
in.readShort();
in.readShort();
}
break;
case 0x18:
in.readInt();
in.readByte();
in.readInt();
in.readInt();
in.readInt();
in.readByte();
in.readByte();
readUnknownBlob();
break;
case 0x19:
in.readInt();
readUTF16();
in.readInt();
in.readInt();
in.readInt();
in.readInt();
break;
case 0x1a:
in.readInt();
in.readInt();
in.readInt();
in.readInt();
in.readShort();
break;
case 0x1c:
readNBytes(10);
break;
case 0x1d:
readNBytes(4);
break;
case 0x1e:
readNBytes(4);
break;
case 0x1f:
readNBytes(7);
break;
case 0x20:
readNBytes(6);
break;
case 0x21:
readNBytes(9);
break;
case 0x22:
readNBytes(18);
break;
case 0x26:
readNBytes(5);
break;
case 0x27:
readNBytes(8);
break;
case 0x28:
in.readInt();
readUnknownBlob();
break;
case 0x29:
in.readInt();
in.readByte();
in.readByte();
in.readShort();
break;
case 0x2a:
in.readInt();
in.readByte();
break;
case 0x2b:
in.readFloat();
in.readShort();
in.readShort();
break;
case 0x32:
readNBytes(9);
break;
case 0x33:
readNBytes(13);
int chunkSize=in.readInt();
readNBytes(chunkSize);
break;
case 0x34:
readNBytes(8);
short arraySize=in.readShort();
readNBytes(arraySize * 4);
break;
case 0x35:
in.readInt();
in.readByte();
in.readInt();
in.readByte();
in.readByte();
break;
case 0x36:
readNBytes(12);
break;
case 0x3c:
readNBytes(28);
int recordCount=in.readInt();
readNBytes(recordCount * 3);
break;
case 0x3d:
in.readInt();
in.readInt();
in.readByte();
in.readInt();
in.readInt();
break;
case 0x46:
readNBytes(2);
break;
case 0x47:
readNBytes(17);
break;
case 0x64:
in.readByte();
in.readByte();
readUTF16();
in.readByte();
break;
case 0x65:
in.readByte();
break;
case 0x66:
in.readByte();
in.readShort();
in.readByte();
in.readShort();
in.readBoolean();
readItem();
break;
case 0x67:
in.readByte();
in.readShort();
readItem();
break;
case 0x68:
in.readByte();
short count=in.readShort();
for (int c=0; c < count; ++c) {
readItem();
}
break;
case 0x69:
in.readByte();
in.readShort();
in.readShort();
break;
case 0x6a:
in.readByte();
in.readShort();
in.readByte();
break;
case 0x6b:
in.readShort();
readItem();
break;
case (byte)0x6c:
readNBytes(2);
break;
case (byte)0x82:
in.readInt();
in.readShort();
in.readInt();
readUTF16();
readUTF16();
readUTF16();
readUTF16();
break;
case (byte)0x83:
in.readShort();
in.readShort();
byte length=in.readByte();
readNBytes(0xff & length);
break;
case (byte)0xc8:
readNBytes(5);
break;
case (byte)0xc9:
readUTF16();
in.readBoolean();
in.readShort();
break;
case (byte)0xe6:
in.readInt();
in.readInt();
readNBytes(in.readInt() * 4);
readNBytes(in.readInt() * 4);
int sizeString=in.readInt();
for (int i=0; i < sizeString; i++) {
readNBytes(in.readInt());
}
break;
case (byte)0xfa:
readUTF16();
short arrayLength=in.readShort();
readNBytes(0xff & arrayLength);
break;
case (byte)0xfe:
break;
default :
error("String_Node_Str" + Integer.toHexString(packetId) + "String_Node_Str"+ Integer.toHexString(lastPacket));
}
lastPacket=packetId;
}