Program: 130588
Project: 130588
Buggy source:
public boolean handleCell(Cell c) throws IOException {
  boolean handled=false;
  if (state == STATES.READY)   receiveWindow--;
  if (receiveWindow < 900) {
    send(new byte[]{00},RELAY_SENDME,false,(short)0);
    receiveWindow+=100;
  }
  if (state == STATES.DESTROYED)   throw new RuntimeException("String_Node_Str");
  if (c.cmdId == Cell.CREATED) {
    handleCreated(c.payload);
    if (!circuitToBuild.isEmpty())     extend(circuitToBuild.removeFirst());
    handled=true;
  }
 else   if (c.cmdId == Cell.RELAY) {
    c.payload=decrypt(c.payload);
    ByteBuffer buf=ByteBuffer.wrap(c.payload);
    int cmd=buf.get();
    if (buf.getShort() != 0)     throw new RuntimeException("String_Node_Str");
    int streamid=buf.getShort();
    TorStream stream=streams.get(new Integer(streamid));
    if (streamid > 0 && stream == null)     System.out.println("String_Node_Str" + streamid);
    int digest=buf.getInt();
    int length=buf.getShort();
    byte data[]=Arrays.copyOfRange(c.payload,1 + 2 + 2+ 4+ 2,1 + 2 + 2+ 4+ 2+ length);
switch (cmd) {
case RELAY_EXTENDED:
      handleCreated(data);
    if (!circuitToBuild.isEmpty())     extend(circuitToBuild.removeFirst());
 else     setState(STATES.READY);
  break;
case RELAY_CONNECTED:
if (stream != null) stream.notifyConnect();
break;
case RELAY_SENDME:
if (streamid == 0) sendWindow+=100;
System.out.println("String_Node_Str" + circId + "String_Node_Str"+ streamid+ "String_Node_Str"+ sendWindow);
break;
case RELAY_DATA:
if (stream != null) stream._putRecved(data);
break;
case RELAY_END:
if (stream != null) {
stream.notifyDisconnect();
streams.remove(new Integer(streamid));
}
break;
default :
System.out.println("String_Node_Str" + cmd);
}
handled=true;
}
 else if (c.cmdId == Cell.DESTROY) {
System.out.println("String_Node_Str" + circId);
System.out.println("String_Node_Str" + Hex.toHexString(c.payload));
for (Iterator<TorStream> iterator=streams.values().iterator(); iterator.hasNext(); ) {
TorStream s=iterator.next();
s.notifyDisconnect();
}
setState(STATES.DESTROYED);
handled=true;
}
return handled;
}

Fixed version (ground truth):
public boolean handleCell(Cell c) throws IOException {
  boolean handled=false;
  if (receiveWindow < 900) {
    send(new byte[]{00},RELAY_SENDME,false,(short)0);
    receiveWindow+=100;
  }
  if (state == STATES.DESTROYED)   throw new RuntimeException("String_Node_Str");
  if (c.cmdId == Cell.CREATED) {
    handleCreated(c.payload);
    if (!circuitToBuild.isEmpty())     extend(circuitToBuild.removeFirst());
    handled=true;
  }
 else   if (c.cmdId == Cell.RELAY) {
    c.payload=decrypt(c.payload);
    ByteBuffer buf=ByteBuffer.wrap(c.payload);
    int cmd=buf.get();
    if (buf.getShort() != 0)     throw new RuntimeException("String_Node_Str");
    int streamid=buf.getShort();
    TorStream stream=streams.get(new Integer(streamid));
    if (streamid > 0 && stream == null)     System.out.println("String_Node_Str" + streamid);
    int digest=buf.getInt();
    int length=buf.getShort();
    byte data[]=Arrays.copyOfRange(c.payload,1 + 2 + 2+ 4+ 2,1 + 2 + 2+ 4+ 2+ length);
switch (cmd) {
case RELAY_EXTENDED:
      handleCreated(data);
    if (!circuitToBuild.isEmpty())     extend(circuitToBuild.removeFirst());
 else     setState(STATES.READY);
  break;
case RELAY_CONNECTED:
if (stream != null) stream.notifyConnect();
break;
case RELAY_SENDME:
if (streamid == 0) sendWindow+=100;
System.out.println("String_Node_Str" + circId + "String_Node_Str"+ streamid+ "String_Node_Str"+ sendWindow);
break;
case RELAY_DATA:
if (state == STATES.READY) receiveWindow--;
if (stream != null) stream._putRecved(data);
break;
case RELAY_END:
if (stream != null) {
stream.notifyDisconnect();
streams.remove(new Integer(streamid));
}
break;
default :
System.out.println("String_Node_Str" + cmd);
}
handled=true;
}
 else if (c.cmdId == Cell.DESTROY) {
System.out.println("String_Node_Str" + circId);
System.out.println("String_Node_Str" + Hex.toHexString(c.payload));
for (Iterator<TorStream> iterator=streams.values().iterator(); iterator.hasNext(); ) {
TorStream s=iterator.next();
s.notifyDisconnect();
}
setState(STATES.DESTROYED);
handled=true;
}
return handled;
}