Program: 38692
Project: 38692
Buggy source:
private Bitmap getCroppedImage(Rect rect){
  Utils.assertTrue(rect.width() > 0 && rect.height() > 0);
  Bundle extras=getIntent().getExtras();
  int outputX=rect.width();
  int outputY=rect.height();
  if (extras != null) {
    outputX=extras.getInt(KEY_OUTPUT_X,outputX);
    outputY=extras.getInt(KEY_OUTPUT_Y,outputY);
  }
  if (outputX * outputY > MAX_PIXEL_COUNT) {
    float scale=(float)Math.sqrt((double)MAX_PIXEL_COUNT / outputX / outputY);
    Log.w(TAG,"String_Node_Str" + scale);
    outputX=Math.round(scale * outputX);
    outputY=Math.round(scale * outputY);
  }
  float scaleX=1;
  float scaleY=1;
  Rect dest=new Rect(0,0,outputX,outputY);
  if (extras == null || extras.getBoolean(KEY_SCALE,true)) {
    scaleX=(float)outputX / rect.width();
    scaleY=(float)outputY / rect.height();
    if (extras == null || !extras.getBoolean(KEY_SCALE_UP_IF_NEEDED,false)) {
      if (scaleX > 1f)       scaleX=1;
      if (scaleY > 1f)       scaleY=1;
    }
  }
  int rectWidth=Math.round(rect.width() * scaleX);
  int rectHeight=Math.round(rect.height() * scaleY);
  dest.set(Math.round((outputX - rectWidth) / 2f),Math.round((outputY - rectHeight) / 2f),Math.round((outputX + rectWidth) / 2f),Math.round((outputY + rectHeight) / 2f));
  if (mBitmapInIntent != null) {
    Bitmap source=mBitmapInIntent;
    Bitmap result=Bitmap.createBitmap(outputX,outputY,Config.ARGB_8888);
    Canvas canvas=new Canvas(result);
    canvas.drawBitmap(source,rect,dest,null);
    return result;
  }
  int rotation=mMediaItem.getFullImageRotation();
  rotateRectangle(rect,mCropView.getImageWidth(),mCropView.getImageHeight(),360 - rotation);
  rotateRectangle(dest,outputX,outputY,360 - rotation);
  if (mUseRegionDecoder) {
    BitmapFactory.Options options=new BitmapFactory.Options();
    int sample=BitmapUtils.computeSampleSizeLarger(Math.max(scaleX,scaleY));
    options.inSampleSize=sample;
    if ((rect.width() / sample) == dest.width() && (rect.height() / sample) == dest.height() && rotation == 0) {
synchronized (mRegionDecoder) {
        return mRegionDecoder.decodeRegion(rect,options);
      }
    }
    Bitmap result=Bitmap.createBitmap(outputX,outputY,Config.ARGB_8888);
    Canvas canvas=new Canvas(result);
    rotateCanvas(canvas,outputX,outputY,rotation);
    drawInTiles(canvas,mRegionDecoder,rect,dest,sample);
    return result;
  }
 else {
    Bitmap result=Bitmap.createBitmap(outputX,outputY,Config.ARGB_8888);
    Canvas canvas=new Canvas(result);
    rotateCanvas(canvas,outputX,outputY,rotation);
    canvas.drawBitmap(mBitmap,rect,dest,new Paint(Paint.FILTER_BITMAP_FLAG));
    return result;
  }
}

Fixed version (ground truth):
private Bitmap getCroppedImage(Rect rect){
  Utils.assertTrue(rect.width() > 0 && rect.height() > 0);
  Bundle extras=getIntent().getExtras();
  int outputX=rect.width();
  int outputY=rect.height();
  if (extras != null) {
    outputX=extras.getInt(KEY_OUTPUT_X,outputX);
    outputY=extras.getInt(KEY_OUTPUT_Y,outputY);
  }
  if (outputX * outputY > MAX_PIXEL_COUNT) {
    float scale=(float)Math.sqrt((double)MAX_PIXEL_COUNT / outputX / outputY);
    Log.w(TAG,"String_Node_Str" + scale);
    outputX=Math.round(scale * outputX);
    outputY=Math.round(scale * outputY);
  }
  float scaleX=1;
  float scaleY=1;
  Rect dest=new Rect(0,0,outputX,outputY);
  if (extras == null || extras.getBoolean(KEY_SCALE,true)) {
    scaleX=(float)outputX / rect.width();
    scaleY=(float)outputY / rect.height();
    if (extras == null || !extras.getBoolean(KEY_SCALE_UP_IF_NEEDED,false)) {
      if (scaleX > 1f)       scaleX=1;
      if (scaleY > 1f)       scaleY=1;
    }
  }
  int rectWidth=Math.round(rect.width() * scaleX);
  int rectHeight=Math.round(rect.height() * scaleY);
  dest.set(Math.round((outputX - rectWidth) / 2f),Math.round((outputY - rectHeight) / 2f),Math.round((outputX + rectWidth) / 2f),Math.round((outputY + rectHeight) / 2f));
  if (mBitmapInIntent != null) {
    Bitmap source=mBitmapInIntent;
    Bitmap result=Bitmap.createBitmap(outputX,outputY,Config.ARGB_8888);
    Canvas canvas=new Canvas(result);
    canvas.drawBitmap(source,rect,dest,null);
    return result;
  }
  if (mUseRegionDecoder) {
    int rotation=mMediaItem.getFullImageRotation();
    rotateRectangle(rect,mCropView.getImageWidth(),mCropView.getImageHeight(),360 - rotation);
    rotateRectangle(dest,outputX,outputY,360 - rotation);
    BitmapFactory.Options options=new BitmapFactory.Options();
    int sample=BitmapUtils.computeSampleSizeLarger(Math.max(scaleX,scaleY));
    options.inSampleSize=sample;
    if ((rect.width() / sample) == dest.width() && (rect.height() / sample) == dest.height() && rotation == 0) {
synchronized (mRegionDecoder) {
        return mRegionDecoder.decodeRegion(rect,options);
      }
    }
    Bitmap result=Bitmap.createBitmap(outputX,outputY,Config.ARGB_8888);
    Canvas canvas=new Canvas(result);
    rotateCanvas(canvas,outputX,outputY,rotation);
    drawInTiles(canvas,mRegionDecoder,rect,dest,sample);
    return result;
  }
 else {
    int rotation=mMediaItem.getRotation();
    rotateRectangle(rect,mCropView.getImageWidth(),mCropView.getImageHeight(),360 - rotation);
    rotateRectangle(dest,outputX,outputY,360 - rotation);
    Bitmap result=Bitmap.createBitmap(outputX,outputY,Config.ARGB_8888);
    Canvas canvas=new Canvas(result);
    rotateCanvas(canvas,outputX,outputY,rotation);
    canvas.drawBitmap(mBitmap,rect,dest,new Paint(Paint.FILTER_BITMAP_FLAG));
    return result;
  }
}