Program: 107670
Project: 107670
Buggy source:
/** 
 * {@inheritDoc}
 * @param inputBuffer input <tt>Buffer</tt>
 * @param outputBuffer output <tt>Buffer</tt>
 * @return <tt>BUFFER_PROCESSED_OK</tt> or <tt>INPUT_BUFFER_NOT_CONSUMED</tt>
 */
protected int doProcess(Buffer inputBuffer,Buffer outputBuffer){
  if (inputBuffer.isDiscard() || ((byte[])inputBuffer.getData()).length == 0) {
    outputBuffer.setDiscard(true);
    return BUFFER_PROCESSED_OK;
  }
  byte[] output;
  int offset;
  boolean haveToCopy=true;
  final int pdMaxLen=DePacketizer.VP8PayloadDescriptor.MAX_LENGTH;
  if (inputBuffer.getLength() <= MAX_SIZE) {
    if (inputBuffer.getOffset() >= pdMaxLen) {
      output=(byte[])inputBuffer.getData();
      offset=inputBuffer.getOffset();
      haveToCopy=false;
    }
 else {
      output=validateByteArraySize(outputBuffer,inputBuffer.getLength() + pdMaxLen);
      offset=pdMaxLen;
    }
  }
 else {
    output=validateByteArraySize(outputBuffer,MAX_SIZE + pdMaxLen);
    offset=pdMaxLen;
  }
  int len=inputBuffer.getLength() <= MAX_SIZE ? inputBuffer.getLength() : MAX_SIZE;
  if (haveToCopy) {
    System.arraycopy((byte[])inputBuffer.getData(),inputBuffer.getOffset(),output,offset,len);
  }
  byte[] pd=DePacketizer.VP8PayloadDescriptor.create(firstPacket);
  System.arraycopy(pd,0,output,offset - pd.length,pd.length);
  offset-=pd.length;
  outputBuffer.setFormat(new VideoFormat(Constants.VP8_RTP));
  outputBuffer.setOffset(offset);
  outputBuffer.setLength(len + pd.length);
  if (inputBuffer.getLength() <= MAX_SIZE) {
    firstPacket=true;
    return BUFFER_PROCESSED_OK;
  }
 else {
    firstPacket=false;
    inputBuffer.setLength(inputBuffer.getLength() - MAX_SIZE);
    inputBuffer.setOffset(inputBuffer.getOffset() + MAX_SIZE);
    return INPUT_BUFFER_NOT_CONSUMED;
  }
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 * @param inputBuffer input <tt>Buffer</tt>
 * @param outputBuffer output <tt>Buffer</tt>
 * @return <tt>BUFFER_PROCESSED_OK</tt> or <tt>INPUT_BUFFER_NOT_CONSUMED</tt>
 */
protected int doProcess(Buffer inputBuffer,Buffer outputBuffer){
  if (inputBuffer.isDiscard() || ((byte[])inputBuffer.getData()).length == 0) {
    outputBuffer.setDiscard(true);
    return BUFFER_PROCESSED_OK;
  }
  byte[] output;
  int offset;
  final int pdMaxLen=DePacketizer.VP8PayloadDescriptor.MAX_LENGTH;
  if (inputBuffer.getLength() <= MAX_SIZE) {
    output=validateByteArraySize(outputBuffer,inputBuffer.getLength() + pdMaxLen);
    offset=pdMaxLen;
  }
 else {
    output=validateByteArraySize(outputBuffer,MAX_SIZE + pdMaxLen);
    offset=pdMaxLen;
  }
  int len=inputBuffer.getLength() <= MAX_SIZE ? inputBuffer.getLength() : MAX_SIZE;
  System.arraycopy((byte[])inputBuffer.getData(),inputBuffer.getOffset(),output,offset,len);
  byte[] pd=DePacketizer.VP8PayloadDescriptor.create(firstPacket);
  System.arraycopy(pd,0,output,offset - pd.length,pd.length);
  offset-=pd.length;
  outputBuffer.setFormat(new VideoFormat(Constants.VP8_RTP));
  outputBuffer.setOffset(offset);
  outputBuffer.setLength(len + pd.length);
  if (inputBuffer.getLength() <= MAX_SIZE) {
    firstPacket=true;
    return BUFFER_PROCESSED_OK;
  }
 else {
    firstPacket=false;
    inputBuffer.setLength(inputBuffer.getLength() - MAX_SIZE);
    inputBuffer.setOffset(inputBuffer.getOffset() + MAX_SIZE);
    return INPUT_BUFFER_NOT_CONSUMED;
  }
}