Program: 67521
Project: 67521
Buggy source:
private int[] getImageSize(IImageContent image,Image imageInfo,ContainerSizeInfo parentSizeInfo,int imageWidthDpi,int imageHeightDpi){
  int imageHeight;
  int imageWidth;
  int imageInfoHeight=(int)(imageInfo.getHeight() * 1000 * ExcelUtil.INCH_PT / imageHeightDpi);
  int imageInfoWidth=(int)(imageInfo.getWidth() * 1000 * ExcelUtil.INCH_PT / imageWidthDpi);
  if (image.getWidth() == null && image.getHeight() == null) {
    int imageFileWidthDpi=imageInfo.getPhysicalWidthDpi() == -1 ? 0 : imageInfo.getPhysicalWidthDpi();
    int imageFileHeightDpi=imageInfo.getPhysicalHeightDpi() == -1 ? 0 : imageInfo.getPhysicalHeightDpi();
    imageWidthDpi=PropertyUtil.getImageDpi(image,imageFileWidthDpi,0);
    imageHeightDpi=PropertyUtil.getImageDpi(image,imageFileHeightDpi,0);
  }
  if (image.getWidth() == null && image.getHeight() != null) {
    imageHeight=LayoutUtil.getImageHeight(image.getHeight(),imageInfoHeight,imageHeightDpi);
    float scale=((float)imageInfoHeight) / ((float)imageInfoWidth);
    imageWidth=(int)(imageHeight / scale);
  }
 else   if (image.getHeight() == null && image.getWidth() != null) {
    imageWidth=LayoutUtil.getImageWidth(image.getWidth(),parentSizeInfo.getWidth(),imageInfoWidth,imageWidthDpi);
    float scale=((float)imageInfoHeight) / ((float)imageInfoWidth);
    imageHeight=(int)(imageWidth * scale);
  }
 else {
    imageHeight=LayoutUtil.getImageHeight(image.getHeight(),imageInfoHeight,imageHeightDpi);
    imageWidth=LayoutUtil.getImageWidth(image.getWidth(),parentSizeInfo.getWidth(),imageInfoWidth,imageWidthDpi);
  }
  int[] imageSize={imageHeight,imageWidth};
  return imageSize;
}

Fixed version (ground truth):
private int[] getImageSize(IImageContent image,Image imageInfo,ContainerSizeInfo parentSizeInfo,int imageWidthDpi,int imageHeightDpi){
  int imageHeight;
  int imageWidth;
  if (image.getWidth() == null && image.getHeight() == null) {
    int imageFileWidthDpi=imageInfo.getPhysicalWidthDpi() == -1 ? 0 : imageInfo.getPhysicalWidthDpi();
    int imageFileHeightDpi=imageInfo.getPhysicalHeightDpi() == -1 ? 0 : imageInfo.getPhysicalHeightDpi();
    imageWidthDpi=PropertyUtil.getImageDpi(image,imageFileWidthDpi,0);
    imageHeightDpi=PropertyUtil.getImageDpi(image,imageFileHeightDpi,0);
  }
  int imageInfoHeight=(int)(imageInfo.getHeight() * 1000 * ExcelUtil.INCH_PT / imageHeightDpi);
  int imageInfoWidth=(int)(imageInfo.getWidth() * 1000 * ExcelUtil.INCH_PT / imageWidthDpi);
  if (image.getWidth() == null && image.getHeight() != null) {
    imageHeight=LayoutUtil.getImageHeight(image.getHeight(),imageInfoHeight,imageHeightDpi);
    float scale=((float)imageInfoHeight) / ((float)imageInfoWidth);
    imageWidth=(int)(imageHeight / scale);
  }
 else   if (image.getHeight() == null && image.getWidth() != null) {
    imageWidth=LayoutUtil.getImageWidth(image.getWidth(),parentSizeInfo.getWidth(),imageInfoWidth,imageWidthDpi);
    float scale=((float)imageInfoHeight) / ((float)imageInfoWidth);
    imageHeight=(int)(imageWidth * scale);
  }
 else {
    imageHeight=LayoutUtil.getImageHeight(image.getHeight(),imageInfoHeight,imageHeightDpi);
    imageWidth=LayoutUtil.getImageWidth(image.getWidth(),parentSizeInfo.getWidth(),imageInfoWidth,imageWidthDpi);
  }
  int[] imageSize={imageHeight,imageWidth};
  return imageSize;
}