Program: 38320
Project: 38320
Buggy source:
public Uri processAndSaveImage(ImagePreset preset){
  Uri uri=resetToOriginalImageIfNeeded(preset);
  if (uri != null) {
    return null;
  }
  resetProgress();
  boolean noBitmap=true;
  int num_tries=0;
  int sampleSize=1;
  Uri newSourceUri=moveSrcToAuxIfNeeded(mSourceUri,mDestinationFile);
  while (noBitmap) {
    try {
      updateProgress();
      Bitmap bitmap=ImageLoader.loadOrientedBitmapWithBackouts(mContext,newSourceUri,sampleSize);
      if (bitmap == null) {
        return null;
      }
      updateProgress();
      CachingPipeline pipeline=new CachingPipeline(FiltersManager.getManager(),"String_Node_Str");
      bitmap=pipeline.renderFinalImage(bitmap,preset);
      updateProgress();
      Object xmp=getPanoramaXMPData(newSourceUri,preset);
      ExifInterface exif=getExifData(newSourceUri);
      updateProgress();
      long time=System.currentTimeMillis();
      exif.addDateTimeStampTag(ExifInterface.TAG_DATE_TIME,time,TimeZone.getDefault());
      exif.setTag(exif.buildTag(ExifInterface.TAG_ORIENTATION,ExifInterface.Orientation.TOP_LEFT));
      exif.removeCompressedThumbnail();
      updateProgress();
      if (putExifData(mDestinationFile,exif,bitmap)) {
        putPanoramaXMPData(mDestinationFile,xmp);
        XmpPresets.writeFilterXMP(mContext,newSourceUri,mDestinationFile,preset);
        uri=SaveImage.updateUriContent(mContext,mSelectedImageUri,mDestinationFile,time);
      }
      updateProgress();
      noBitmap=false;
      UsageStatistics.onEvent(UsageStatistics.COMPONENT_EDITOR,"String_Node_Str",null);
    }
 catch (    OutOfMemoryError e) {
      if (++num_tries >= 5) {
        throw e;
      }
      System.gc();
      sampleSize*=2;
      resetProgress();
    }
  }
  return uri;
}

Fixed version (ground truth):
public Uri processAndSaveImage(ImagePreset preset){
  Uri uri=resetToOriginalImageIfNeeded(preset);
  if (uri != null) {
    return null;
  }
  resetProgress();
  boolean noBitmap=true;
  int num_tries=0;
  int sampleSize=1;
  Uri newSourceUri=moveSrcToAuxIfNeeded(mSourceUri,mDestinationFile);
  while (noBitmap) {
    try {
      updateProgress();
      Bitmap bitmap=ImageLoader.loadOrientedBitmapWithBackouts(mContext,newSourceUri,sampleSize);
      if (bitmap == null) {
        return null;
      }
      updateProgress();
      CachingPipeline pipeline=new CachingPipeline(FiltersManager.getManager(),"String_Node_Str");
      bitmap=pipeline.renderFinalImage(bitmap,preset);
      updateProgress();
      Object xmp=getPanoramaXMPData(newSourceUri,preset);
      ExifInterface exif=getExifData(newSourceUri);
      updateProgress();
      long time=System.currentTimeMillis();
      exif.addDateTimeStampTag(ExifInterface.TAG_DATE_TIME,time,TimeZone.getDefault());
      exif.setTag(exif.buildTag(ExifInterface.TAG_ORIENTATION,ExifInterface.Orientation.TOP_LEFT));
      exif.removeCompressedThumbnail();
      updateProgress();
      if (putExifData(mDestinationFile,exif,bitmap)) {
        putPanoramaXMPData(mDestinationFile,xmp);
        XmpPresets.writeFilterXMP(mContext,newSourceUri,mDestinationFile,preset);
        uri=SaveImage.linkNewFileToUri(mContext,mSelectedImageUri,mDestinationFile,time);
      }
      updateProgress();
      noBitmap=false;
      UsageStatistics.onEvent(UsageStatistics.COMPONENT_EDITOR,"String_Node_Str",null);
    }
 catch (    OutOfMemoryError e) {
      if (++num_tries >= 5) {
        throw e;
      }
      System.gc();
      sampleSize*=2;
      resetProgress();
    }
  }
  return uri;
}