Program: 130287
Project: 130287
Buggy source:
/** 
 * Constructs a   {@link PeerPcpResponse} object by parsing a buffer.
 * @param buffer buffer containing PCP response data
 * @throws NullPointerException if any argument is {@code null}
 * @throws BufferUnderflowException if not enough data is available in {@code buffer}
 * @throws IllegalArgumentException if any numeric argument is negative, or if {@code buffer} isn't the right size (max of 1100 bytes)or is malformed ( {@code r-flag != 1 || op == 2 || 0L > lifetime > 0xFFFFFFFFL || mappingNonce.length != 12|| 1 > protocol > 255 || 1 > internalPort > 65535 || (resultCode == 0 ? 1 > assignedExternalPort > 65535 : 0 > assignedExternalPort > 65535) || 1 > remotePeerPort > 65535}) or contains an unparseable options region.
 */
public PeerPcpResponse(byte[] buffer){
  super(buffer,DATA_LENGTH);
  Validate.isTrue(super.getOp() == OPCODE);
  int remainingLength=buffer.length - HEADER_LENGTH;
  Validate.isTrue(remainingLength >= DATA_LENGTH);
  int offset=HEADER_LENGTH;
  mappingNonce=new byte[NONCE_LENGTH];
  System.arraycopy(buffer,offset,mappingNonce,0,mappingNonce.length);
  offset+=mappingNonce.length;
  protocol=buffer[offset] & 0xFF;
  offset++;
  offset+=3;
  internalPort=InternalUtils.bytesToShort(buffer,offset);
  offset+=2;
  assignedExternalPort=InternalUtils.bytesToShort(buffer,offset);
  offset+=2;
  assignedExternalIpAddress=NetworkUtils.convertBytesToAddress(buffer,offset,16);
  offset+=16;
  remotePeerPort=InternalUtils.bytesToShort(buffer,offset);
  offset+=2;
  offset+=2;
  remotePeerIpAddress=NetworkUtils.convertBytesToAddress(buffer,offset,16);
  offset+=16;
  validateState();
}

Fixed version (ground truth):
/** 
 * Constructs a   {@link PeerPcpResponse} object by parsing a buffer.
 * @param buffer buffer containing PCP response data
 * @throws NullPointerException if any argument is {@code null}
 * @throws BufferUnderflowException if not enough data is available in {@code buffer}
 * @throws IllegalArgumentException if any numeric argument is negative, or if {@code buffer} isn't the right size (max of 1100 bytes)or is malformed ( {@code r-flag != 1 || op == 2 || 0L > lifetime > 0xFFFFFFFFL || mappingNonce.length != 12|| 1 > protocol > 255 || 1 > internalPort > 65535 || (resultCode == 0 ? 1 > assignedExternalPort > 65535 : 0 > assignedExternalPort > 65535) || 1 > remotePeerPort > 65535}) or contains an unparseable options region.
 */
public PeerPcpResponse(byte[] buffer){
  super(buffer,DATA_LENGTH);
  Validate.isTrue(super.getOp() == OPCODE);
  int remainingLength=buffer.length - HEADER_LENGTH;
  Validate.isTrue(remainingLength >= DATA_LENGTH);
  int offset=HEADER_LENGTH;
  mappingNonce=new byte[NONCE_LENGTH];
  System.arraycopy(buffer,offset,mappingNonce,0,mappingNonce.length);
  offset+=mappingNonce.length;
  protocol=buffer[offset] & 0xFF;
  offset++;
  offset+=3;
  internalPort=InternalUtils.bytesToShort(buffer,offset) & 0xFFFF;
  offset+=2;
  assignedExternalPort=InternalUtils.bytesToShort(buffer,offset) & 0xFFFF;
  offset+=2;
  assignedExternalIpAddress=NetworkUtils.convertBytesToAddress(buffer,offset,16);
  offset+=16;
  remotePeerPort=InternalUtils.bytesToShort(buffer,offset) & 0xFFFF;
  offset+=2;
  offset+=2;
  remotePeerIpAddress=NetworkUtils.convertBytesToAddress(buffer,offset,16);
  offset+=16;
  validateState();
}