Program: 67643
Project: 67643
Buggy source:
public void addImageData(IImageContent image,IStyle style,HyperlinkDef link,BookmarkDef bookmark){
  int imageWidthDpi;
  int imageHeightDpi;
  try {
    Image imageInfo=EmitterUtil.parseImage(image,image.getImageSource(),image.getURI(),image.getMIMEType(),image.getExtension());
    int imageFileWidthDpi=imageInfo.getPhysicalWidthDpi() == -1 ? 0 : imageInfo.getPhysicalWidthDpi();
    int imageFileHeightDpi=imageInfo.getPhysicalHeightDpi() == -1 ? 0 : imageInfo.getPhysicalHeightDpi();
    if (image.getWidth() == null) {
      imageWidthDpi=PropertyUtil.getImageDpi(image,imageFileWidthDpi,0);
    }
 else {
      imageWidthDpi=reportDpi;
    }
    if (image.getHeight() == null) {
      imageHeightDpi=PropertyUtil.getImageDpi(image,imageFileHeightDpi,0);
    }
 else {
      imageHeightDpi=reportDpi;
    }
  }
 catch (  IOException ex) {
    imageWidthDpi=reportDpi;
    imageHeightDpi=reportDpi;
  }
  XlsContainer container=getCurrentContainer();
  ContainerSizeInfo parentSizeInfo=container.getSizeInfo();
  ColumnsInfo imageColumnsInfo=LayoutUtil.createImage(image,parentSizeInfo.getWidth(),imageWidthDpi);
  splitColumns(imageColumnsInfo,parentSizeInfo);
  ContainerSizeInfo imageSize=new ContainerSizeInfo(parentSizeInfo.getStartCoordinate(),imageColumnsInfo.getTotalWidth());
  StyleEntry entry=engine.getStyle(style,imageSize,parentSizeInfo,getParentStyle(container));
  setlinkStyle(entry,link);
  SheetData data=createImageData(image,imageSize.getWidth(),entry,container,imageHeightDpi,imageWidthDpi);
  data.setHyperlinkDef(link);
  data.setBookmark(bookmark);
  data.setStartX(imageSize.getStartCoordinate());
  data.setEndX(imageSize.getEndCoordinate());
  addData(data);
}

Fixed version (ground truth):
public void addImageData(IImageContent image,IStyle style,HyperlinkDef link,BookmarkDef bookmark){
  XlsContainer container=getCurrentContainer();
  ContainerSizeInfo parentSizeInfo=container.getSizeInfo();
  int imageWidthDpi=reportDpi;
  int imageHeightDpi=reportDpi;
  int imageHeight;
  int imageWidth;
  byte[] imageData=null;
  try {
    Image imageInfo=EmitterUtil.parseImage(image,image.getImageSource(),image.getURI(),image.getMIMEType(),image.getExtension());
    imageData=imageInfo.getData();
    int[] imageSize=getImageSize(image,imageInfo,parentSizeInfo,imageWidthDpi,imageHeightDpi);
    imageHeight=imageSize[0];
    imageWidth=imageSize[1];
  }
 catch (  IOException ex) {
    imageHeight=LayoutUtil.getImageHeight(image.getHeight(),0,imageHeightDpi);
    imageWidth=LayoutUtil.getImageWidth(image.getWidth(),parentSizeInfo.getWidth(),0,imageWidthDpi);
  }
  ColumnsInfo imageColumnsInfo=LayoutUtil.createImage(imageWidth);
  splitColumns(imageColumnsInfo,parentSizeInfo);
  ContainerSizeInfo imageSize=new ContainerSizeInfo(parentSizeInfo.getStartCoordinate(),imageColumnsInfo.getTotalWidth());
  StyleEntry entry=engine.getStyle(style,imageSize,parentSizeInfo,getParentStyle(container));
  setlinkStyle(entry,link);
  SheetData data=createImageData(image,imageData,imageSize.getWidth(),imageHeight,entry,container);
  data.setHyperlinkDef(link);
  data.setBookmark(bookmark);
  data.setStartX(imageSize.getStartCoordinate());
  data.setEndX(imageSize.getEndCoordinate());
  addData(data);
}