Program: 103717
Project: 103717
Buggy source:
/** 
 * Process (format conversion, rescale) a buffer.
 * @param input input buffer
 * @param output output buffer
 * @return BUFFER_PROCESSED_OK if buffer successfully processed
 */
@Override public int process(Buffer input,Buffer output){
  VideoFormat vinput=(VideoFormat)input.getFormat();
  VideoFormat voutput=(VideoFormat)output.getFormat();
  int inputWidth=(int)vinput.getSize().getWidth();
  int inputHeight=(int)vinput.getSize().getHeight();
  Object src=input.getData();
  Object dst=output.getData();
  int outputSize=0;
  int outputWidth=0;
  int outputHeight=0;
  int infmt=0;
  int outfmt=0;
  if (voutput == null) {
    voutput=(VideoFormat)outputFormat;
    return BUFFER_PROCESSED_FAILED;
  }
  outputWidth=(int)voutput.getSize().getWidth();
  outputHeight=(int)voutput.getSize().getHeight();
  if (!checkInputBuffer(input)) {
    return BUFFER_PROCESSED_FAILED;
  }
  if (isEOM(input)) {
    propagateEOM(output);
    return BUFFER_PROCESSED_OK;
  }
  if (voutput instanceof YUVFormat) {
    outputSize=(int)(outputWidth * outputHeight * 1.5);
    outfmt=FFMPEG.PIX_FMT_YUV420P;
  }
 else {
    RGBFormat rgb=(RGBFormat)voutput;
    outfmt=FFMPEG.PIX_FMT_RGB32;
    outputSize=(outputWidth * outputHeight * 4);
  }
  if (vinput instanceof YUVFormat) {
    infmt=FFMPEG.PIX_FMT_YUV420P;
  }
 else {
    RGBFormat rgb=(RGBFormat)vinput;
    infmt=getNativeRGBFormat(rgb);
  }
  if (voutput.getDataType() == Format.byteArray) {
    if (dst == null || ((byte[])dst).length < outputSize) {
      dst=new byte[outputSize];
    }
  }
 else   if (voutput.getDataType() == Format.intArray) {
    outputSize=(outputSize % 4) + outputSize / 4;
    if (dst == null || ((int[])dst).length < outputSize) {
      dst=new int[outputSize];
    }
  }
 else   if (voutput.getDataType() == Format.shortArray) {
    outputSize=(outputSize % 2) + outputSize / 2;
    if (dst == null || ((short[])dst).length < outputSize) {
      dst=new short[outputSize];
    }
  }
 else {
    System.out.println("String_Node_Str");
    return BUFFER_PROCESSED_FAILED;
  }
synchronized (src) {
    FFMPEG.img_convert(dst,outfmt,src,infmt,inputWidth,inputHeight,outputWidth,outputHeight);
  }
  output.setData(dst);
  output.setLength(outputSize);
  output.setOffset(0);
  return BUFFER_PROCESSED_OK;
}

Fixed version (ground truth):
/** 
 * Processes (converts color space and/or scales) a buffer.
 * @param input input buffer
 * @param output output buffer
 * @return <tt>BUFFER_PROCESSED_OK</tt> if buffer has been successfullyprocessed
 */
@Override public int process(Buffer input,Buffer output){
  if (!checkInputBuffer(input))   return BUFFER_PROCESSED_FAILED;
  if (isEOM(input)) {
    propagateEOM(output);
    return BUFFER_PROCESSED_OK;
  }
  VideoFormat outputFormat=(VideoFormat)output.getFormat();
  if (outputFormat == null) {
    outputFormat=(VideoFormat)this.outputFormat;
    if (outputFormat == null)     return BUFFER_PROCESSED_FAILED;
  }
  int dstFmt;
  int dstLength;
  Dimension outputSize=outputFormat.getSize();
  int outputWidth=outputSize.width;
  int outputHeight=outputSize.height;
  if (outputFormat instanceof YUVFormat) {
    dstFmt=FFMPEG.PIX_FMT_YUV420P;
    dstLength=(int)(outputWidth * outputHeight * 1.5);
  }
 else {
    dstFmt=FFMPEG.PIX_FMT_RGB32;
    dstLength=(outputWidth * outputHeight * 4);
  }
  VideoFormat inputFormat=(VideoFormat)input.getFormat();
  int srcFmt;
  if (inputFormat instanceof YUVFormat)   srcFmt=FFMPEG.PIX_FMT_YUV420P;
 else   srcFmt=getNativeRGBFormat((RGBFormat)inputFormat);
  Class<?> outputDataType=outputFormat.getDataType();
  Object dst=output.getData();
  if (Format.byteArray.equals(outputDataType)) {
    if (dst == null || ((byte[])dst).length < dstLength)     dst=new byte[dstLength];
  }
 else   if (Format.intArray.equals(outputDataType)) {
    dstLength=(dstLength % 4) + dstLength / 4;
    if (dst == null || ((int[])dst).length < dstLength)     dst=new int[dstLength];
  }
 else   if (Format.shortArray.equals(outputDataType)) {
    dstLength=(dstLength % 2) + dstLength / 2;
    if (dst == null || ((short[])dst).length < dstLength)     dst=new short[dstLength];
  }
 else {
    logger.error("String_Node_Str" + outputDataType);
    return BUFFER_PROCESSED_FAILED;
  }
  Object src=input.getData();
synchronized (src) {
    Dimension inputSize=inputFormat.getSize();
    FFMPEG.img_convert(dst,dstFmt,src,srcFmt,inputSize.width,inputSize.height,outputWidth,outputHeight);
  }
  output.setData(dst);
  output.setLength(dstLength);
  output.setOffset(0);
  return BUFFER_PROCESSED_OK;
}