Program: 105045
Project: 105045
Buggy source:
private void runOnDtlsTransport(StreamConnector connector) throws IOException {
  DtlsControlImpl dtlsControl=(DtlsControlImpl)getTransportManager().getDtlsControl(this);
  DtlsTransformEngine engine=dtlsControl.getTransformEngine();
  final DtlsPacketTransformer transformer=(DtlsPacketTransformer)engine.getRTPTransformer();
  byte[] receiveBuffer=new byte[SCTP_BUFFER_SIZE];
  if (LOG_SCTP_PACKETS) {
    System.setProperty(ConfigurationService.PNAME_SC_HOME_DIR_LOCATION,System.getProperty("String_Node_Str"));
    System.setProperty(ConfigurationService.PNAME_SC_HOME_DIR_NAME,SctpConnection.class.getName());
  }
synchronized (this) {
    sctpSocket=Sctp.createSocket(5000);
    assocIsUp=false;
    peerAddrIsConfirmed=false;
  }
  sctpSocket.setLink(new NetworkLink(){
    @Override public void onConnOut(    SctpSocket s,    byte[] packet) throws IOException {
      if (LOG_SCTP_PACKETS) {
        LibJitsi.getPacketLoggingService().logPacket(PacketLoggingService.ProtocolName.ICE4J,new byte[]{0,0,0,(byte)debugId},5000,new byte[]{0,0,0,(byte)(debugId + 1)},remoteSctpPort,PacketLoggingService.TransportName.UDP,true,packet);
      }
      transformer.sendApplicationData(packet,0,packet.length);
    }
  }
);
  if (logger.isDebugEnabled()) {
    logger.debug("String_Node_Str" + remoteSctpPort + "String_Node_Str"+ getEndpoint().getID());
  }
  sctpSocket.setNotificationListener(this);
  sctpSocket.listen();
  threadPool.execute(new Runnable(){
    @Override public void run(){
      SctpSocket sctpSocket=null;
      try {
        sctpSocket=SctpConnection.this.sctpSocket;
        while (sctpSocket != null && !sctpSocket.accept()) {
          Thread.sleep(100);
          sctpSocket=SctpConnection.this.sctpSocket;
        }
      }
 catch (      Exception e) {
        logger.error("String_Node_Str",e);
      }
      if (sctpSocket == null && logger.isInfoEnabled()) {
        logger.info("String_Node_Str" + getID() + "String_Node_Str"+ "String_Node_Str");
      }
    }
  }
);
  sctpSocket.setDataCallback(this);
  DatagramSocket datagramSocket=connector.getDataSocket();
  if (datagramSocket != null) {
    this.iceSocket=new IceUdpSocketWrapper(datagramSocket);
  }
 else {
    this.iceSocket=new IceTcpSocketWrapper(connector.getDataTCPSocket());
  }
  DatagramPacket rcvPacket=new DatagramPacket(receiveBuffer,0,receiveBuffer.length);
  try {
    do {
      iceSocket.receive(rcvPacket);
      RawPacket raw=new RawPacket(rcvPacket.getData(),rcvPacket.getOffset(),rcvPacket.getLength());
      raw=transformer.reverseTransform(raw);
      if (raw == null)       continue;
      if (LOG_SCTP_PACKETS) {
        LibJitsi.getPacketLoggingService().logPacket(PacketLoggingService.ProtocolName.ICE4J,new byte[]{0,0,0,(byte)(debugId + 1)},remoteSctpPort,new byte[]{0,0,0,(byte)debugId},5000,PacketLoggingService.TransportName.UDP,false,raw.getBuffer(),raw.getOffset(),raw.getLength());
      }
      sctpSocket.onConnIn(raw.getBuffer(),raw.getOffset(),raw.getLength());
    }
 while (true);
  }
  finally {
synchronized (this) {
      assocIsUp=false;
      peerAddrIsConfirmed=false;
      if (sctpSocket != null) {
        sctpSocket.close();
        sctpSocket=null;
      }
    }
  }
}

Fixed version (ground truth):
private void runOnDtlsTransport(StreamConnector connector) throws IOException {
  DtlsControlImpl dtlsControl=(DtlsControlImpl)getTransportManager().getDtlsControl(this);
  DtlsTransformEngine engine=dtlsControl.getTransformEngine();
  final DtlsPacketTransformer transformer=(DtlsPacketTransformer)engine.getRTPTransformer();
  byte[] receiveBuffer=new byte[SCTP_BUFFER_SIZE];
  if (LOG_SCTP_PACKETS) {
    System.setProperty(ConfigurationService.PNAME_SC_HOME_DIR_LOCATION,System.getProperty("String_Node_Str"));
    System.setProperty(ConfigurationService.PNAME_SC_HOME_DIR_NAME,SctpConnection.class.getName());
  }
synchronized (this) {
    sctpSocket=Sctp.createSocket(5000);
    assocIsUp=false;
    acceptedIncomingConnection=false;
  }
  sctpSocket.setLink(new NetworkLink(){
    @Override public void onConnOut(    SctpSocket s,    byte[] packet) throws IOException {
      if (LOG_SCTP_PACKETS) {
        LibJitsi.getPacketLoggingService().logPacket(PacketLoggingService.ProtocolName.ICE4J,new byte[]{0,0,0,(byte)debugId},5000,new byte[]{0,0,0,(byte)(debugId + 1)},remoteSctpPort,PacketLoggingService.TransportName.UDP,true,packet);
      }
      transformer.sendApplicationData(packet,0,packet.length);
    }
  }
);
  if (logger.isDebugEnabled()) {
    logger.debug("String_Node_Str" + remoteSctpPort + "String_Node_Str"+ getEndpoint().getID());
  }
  sctpSocket.setNotificationListener(this);
  sctpSocket.listen();
  threadPool.execute(new Runnable(){
    @Override public void run(){
      SctpSocket sctpSocket=null;
      try {
        sctpSocket=SctpConnection.this.sctpSocket;
        while (sctpSocket != null) {
          if (sctpSocket.accept()) {
            acceptedIncomingConnection=true;
            break;
          }
          Thread.sleep(100);
          sctpSocket=SctpConnection.this.sctpSocket;
        }
        if (isReady()) {
          notifySctpConnectionReady();
        }
      }
 catch (      Exception e) {
        logger.error("String_Node_Str",e);
      }
      if (sctpSocket == null && logger.isInfoEnabled()) {
        logger.info("String_Node_Str" + getID() + "String_Node_Str"+ "String_Node_Str");
      }
    }
  }
);
  sctpSocket.setDataCallback(this);
  DatagramSocket datagramSocket=connector.getDataSocket();
  if (datagramSocket != null) {
    this.iceSocket=new IceUdpSocketWrapper(datagramSocket);
  }
 else {
    this.iceSocket=new IceTcpSocketWrapper(connector.getDataTCPSocket());
  }
  DatagramPacket rcvPacket=new DatagramPacket(receiveBuffer,0,receiveBuffer.length);
  try {
    do {
      iceSocket.receive(rcvPacket);
      RawPacket raw=new RawPacket(rcvPacket.getData(),rcvPacket.getOffset(),rcvPacket.getLength());
      raw=transformer.reverseTransform(raw);
      if (raw == null)       continue;
      if (LOG_SCTP_PACKETS) {
        LibJitsi.getPacketLoggingService().logPacket(PacketLoggingService.ProtocolName.ICE4J,new byte[]{0,0,0,(byte)(debugId + 1)},remoteSctpPort,new byte[]{0,0,0,(byte)debugId},5000,PacketLoggingService.TransportName.UDP,false,raw.getBuffer(),raw.getOffset(),raw.getLength());
      }
      sctpSocket.onConnIn(raw.getBuffer(),raw.getOffset(),raw.getLength());
    }
 while (true);
  }
  finally {
synchronized (this) {
      assocIsUp=false;
      acceptedIncomingConnection=false;
      if (sctpSocket != null) {
        sctpSocket.close();
        sctpSocket=null;
      }
    }
  }
}