Program: 178647
Project: 178647
Buggy source:
public Packet decompress(Packet packet,PassthroughConnection ptc){
  int length=packet.getInt(14);
  Packet newPacket=packet.clone(fm);
  byte[] buffer=newPacket.buffer;
  int start=18;
  if (length > 131072) {
    return null;
  }
  i.reset();
  i.setInput(buffer,start,length);
  i.finished();
  int expandedLength;
  try {
    expandedLength=i.inflate(decompressed,0,decompressed.length);
  }
 catch (  DataFormatException dfe) {
    ptc.printLogMessage("String_Node_Str");
    return null;
  }
  if (expandedLength != 81920 + 320) {
    ptc.printLogMessage("String_Node_Str");
    return null;
  }
  HashManager.extractHashesList(decompressed,packetHashes);
  for (int cnt=0; cnt < 40; cnt++) {
    byte[] block=hs.getHash(ptc,packetHashes[cnt]);
    if (block != null) {
      HashGenerator.copyToBuffer(decompressed,cnt,block);
    }
 else {
      block=new byte[2048];
      HashGenerator.copyFromBuffer(decompressed,cnt,block);
      hs.addHash(packetHashes[cnt],block);
    }
  }
  d.reset();
  d.setInput(decompressed,0,expandedLength - 320);
  d.finish();
  int newSize=d.deflate(compressed);
  Packet outPacket=new Packet();
  outPacket.buffer=new byte[newSize + 18];
  outPacket.writeByte((byte)0x33);
  outPacket.writeInt(packet.getInt(1));
  outPacket.writeShort(packet.getShort(5));
  outPacket.writeInt(packet.getInt(7));
  outPacket.writeByte(packet.getByte(11));
  outPacket.writeByte(packet.getByte(12));
  outPacket.writeByte(packet.getByte(13));
  outPacket.writeInt(newSize);
  System.arraycopy(compressed,0,outPacket.buffer,18,newSize);
  outPacket.end+=newSize;
  ptc.connectionInfo.saved.addAndGet(newSize - length);
  if (Main.craftGUI != null) {
    int percent=(int)(((100.0) * ptc.connectionInfo.saved.get()) / ptc.connectionInfo.uploaded.get());
    Main.craftGUI.safeSetStatus("String_Node_Str" + (ptc.connectionInfo.saved.get() / 1024) + "String_Node_Str"+ percent+ "String_Node_Str");
  }
  return outPacket;
}

Fixed version (ground truth):
public Packet decompress(Packet packet,PassthroughConnection ptc){
  int length=packet.getInt(14);
  Packet newPacket=packet.clone(fm);
  byte[] buffer=newPacket.buffer;
  int start=18;
  if (length > 131072) {
    return null;
  }
  i.reset();
  i.setInput(buffer,start,length);
  i.finished();
  int expandedLength;
  try {
    expandedLength=i.inflate(decompressed,0,decompressed.length);
  }
 catch (  DataFormatException dfe) {
    ptc.printLogMessage("String_Node_Str");
    return null;
  }
  if (expandedLength != 81920 + 320) {
    ptc.printLogMessage("String_Node_Str");
    return null;
  }
  HashManager.extractHashesList(decompressed,packetHashes);
  for (int cnt=0; cnt < 40; cnt++) {
    byte[] block=hs.getHash(ptc,packetHashes[cnt]);
    if (block != null) {
      HashGenerator.copyToBuffer(decompressed,cnt,block);
    }
 else {
      block=new byte[2048];
      HashGenerator.copyFromBuffer(decompressed,cnt,block);
      hs.addHash(packetHashes[cnt],block);
    }
  }
  d.reset();
  d.setInput(decompressed,0,expandedLength - 320);
  d.finish();
  int newSize=d.deflate(compressed);
  Packet outPacket=new Packet();
  outPacket.buffer=new byte[newSize + 18];
  outPacket.writeByte((byte)0x33);
  outPacket.writeInt(packet.getInt(1));
  outPacket.writeShort(packet.getShort(5));
  outPacket.writeInt(packet.getInt(7));
  outPacket.writeByte(packet.getByte(11));
  outPacket.writeByte(packet.getByte(12));
  outPacket.writeByte(packet.getByte(13));
  outPacket.writeInt(newSize);
  System.arraycopy(compressed,0,outPacket.buffer,18,newSize);
  outPacket.end+=newSize;
  ptc.connectionInfo.saved.addAndGet(newSize - length);
  int percent=(int)(((100.0) * ptc.connectionInfo.saved.get()) / ptc.connectionInfo.uploaded.get());
  if (Main.craftGUI != null) {
    Main.craftGUI.safeSetStatus("String_Node_Str" + (ptc.connectionInfo.saved.get() / 1024) + "String_Node_Str"+ percent+ "String_Node_Str");
  }
 else {
  }
  return outPacket;
}