Program: 70477
Project: 70477
Buggy source:
protected void init() throws BirtException {
  if (PropertyUtil.isInlineElement(image)) {
    root=new ImageInlineContainer(parent,context,image);
  }
 else {
    root=new ImageBlockContainer(parent,context,image);
  }
  root.initialize();
  root.setAllocatedWidth(parent.getCurrentMaxContentWidth());
  root.setMaxAvaWidth(root.getContentWidth());
  Dimension contentDimension=getSpecifiedDimension(image,root.getContentWidth(),true);
  ImageArea imageArea=createImageArea(image);
  int actualHeight=contentDimension.getHeight();
  int actualWidth=contentDimension.getWidth();
  int maxHeight=root.getMaxAvaHeight();
  int maxWidth=root.getMaxAvaWidth();
  int cHeight=contentDimension.getHeight();
  int cWidth=contentDimension.getWidth();
  if (cHeight > maxHeight || cWidth > maxWidth) {
    if (fitToContainer) {
      float rh=((float)maxHeight) / cHeight;
      float rw=((float)maxWidth) / cWidth;
      if (rh > rw) {
        actualHeight=(int)(rw * maxHeight);
        actualWidth=maxWidth;
      }
 else {
        actualHeight=maxHeight;
        actualWidth=(int)(rh * maxWidth);
      }
    }
 else {
      root.setNeedClip(true);
      root.setAllocatedHeight(Math.min(maxHeight,cHeight));
      root.setAllocatedWidth(Math.min(maxWidth,cWidth));
    }
    imageArea.setWidth(actualWidth);
    imageArea.setHeight(actualHeight);
  }
 else {
    imageArea.setWidth(actualWidth);
    imageArea.setHeight(actualHeight);
    root.setContentWidth(imageArea.getWidth());
    root.setContentHeight(imageArea.getHeight());
  }
  root.addChild(imageArea);
  imageArea.setPosition(root.getContentX(),root.getContentY());
  processChartLegend(image,imageArea);
  root.finished=true;
}

Fixed version (ground truth):
protected void init() throws BirtException {
  if (PropertyUtil.isInlineElement(image)) {
    root=new ImageInlineContainer(parent,context,image);
  }
 else {
    root=new ImageBlockContainer(parent,context,image);
  }
  root.initialize();
  root.setAllocatedWidth(parent.getCurrentMaxContentWidth());
  root.setMaxAvaWidth(root.getContentWidth());
  Dimension contentDimension=getSpecifiedDimension(image,root.getContentWidth(),true);
  ImageArea imageArea=createImageArea(image);
  int actualHeight=contentDimension.getHeight();
  int actualWidth=contentDimension.getWidth();
  int maxHeight=root.getMaxAvaHeight();
  int maxWidth=root.getMaxAvaWidth();
  int cHeight=contentDimension.getHeight();
  int cWidth=contentDimension.getWidth();
  if (cHeight > maxHeight || cWidth > maxWidth) {
    if (fitToContainer) {
      float rh=((float)maxHeight) / cHeight;
      float rw=((float)maxWidth) / cWidth;
      if (rh > rw) {
        actualHeight=(int)(rw * maxHeight);
        actualWidth=maxWidth;
      }
 else {
        actualHeight=maxHeight;
        actualWidth=(int)(rh * maxWidth);
      }
    }
 else {
      root.setNeedClip(true);
      root.setAllocatedHeight(Math.min(maxHeight,cHeight));
      root.setAllocatedWidth(Math.min(maxWidth,cWidth));
    }
    imageArea.setWidth(actualWidth);
    imageArea.setHeight(actualHeight);
  }
 else {
    imageArea.setWidth(actualWidth);
    imageArea.setHeight(actualHeight);
    root.setContentWidth(imageArea.getWidth());
    root.setContentHeight(imageArea.getHeight());
  }
  root.addChild(imageArea);
  imageArea.setPosition(root.getContentX(),root.getContentY());
  processChartLegend(image,imageArea);
  root.finished=false;
}