Program: 70840
Project: 70840
Buggy source:
protected void createRoot(){
  currentContext.root=new PageArea(((PageContext)currentContext).pageContent);
  PageArea page=(PageArea)currentContext.root;
  int overFlowType=context.getPageOverflow();
  if (overFlowType == IPDFRenderOption.OUTPUT_TO_MULTIPLE_PAGES) {
  }
  pageContentWidth=getDimensionValue(pageContent.getPageWidth());
  pageContentHeight=getDimensionValue(pageContent.getPageHeight());
  if (pageContentWidth <= 0) {
    pageContentWidth=DEFAULT_PAGE_WIDTH;
  }
  if (pageContentHeight <= 0) {
    pageContentHeight=DEFAULT_PAGE_HEIGHT;
  }
  page.setWidth(pageContentWidth);
  page.setHeight(pageContentHeight);
  ContainerArea pageRoot=new LogicContainerArea(report);
  rootLeft=getDimensionValue(pageContent.getMarginLeft(),pageContentWidth);
  rootTop=getDimensionValue(pageContent.getMarginTop(),pageContentWidth);
  rootLeft=Math.max(0,rootLeft);
  rootLeft=Math.min(pageContentWidth,rootLeft);
  rootTop=Math.max(0,rootTop);
  rootTop=Math.min(pageContentHeight,rootTop);
  pageRoot.setPosition(rootLeft,rootTop);
  int rootRight=getDimensionValue(pageContent.getMarginRight(),pageContentWidth);
  int rootBottom=getDimensionValue(pageContent.getMarginBottom(),pageContentWidth);
  rootRight=Math.max(0,rootRight);
  rootBottom=Math.max(0,rootBottom);
  if (rootLeft + rootRight > pageContentWidth) {
    rootRight=0;
  }
  if (rootTop + rootBottom > pageContentHeight) {
    rootBottom=0;
  }
  rootWidth=pageContentWidth - rootLeft - rootRight;
  rootHeight=pageContentHeight - rootTop - rootBottom;
  pageRoot.setWidth(rootWidth);
  pageRoot.setHeight(rootHeight);
  page.setRoot(pageRoot);
  int headerHeight=getDimensionValue(pageContent.getHeaderHeight(),pageRoot.getHeight());
  int headerWidth=pageRoot.getWidth();
  headerHeight=Math.max(0,headerHeight);
  headerHeight=Math.min(pageRoot.getHeight(),headerHeight);
  ContainerArea header=new LogicContainerArea(report);
  header.setHeight(headerHeight);
  header.setWidth(headerWidth);
  header.setPosition(0,0);
  pageRoot.addChild(header);
  page.setHeader(header);
  int footerHeight=getDimensionValue(pageContent.getFooterHeight(),pageRoot.getHeight());
  int footerWidth=pageRoot.getWidth();
  footerHeight=Math.max(0,footerHeight);
  footerHeight=Math.min(pageRoot.getHeight() - headerHeight,footerHeight);
  ContainerArea footer=new LogicContainerArea(report);
  footer.setHeight(footerHeight);
  footer.setWidth(footerWidth);
  footer.setPosition(0,pageRoot.getHeight() - footerHeight);
  pageRoot.addChild(footer);
  page.setFooter(footer);
  ContainerArea body=new LogicContainerArea(report);
  int bodyLeft=getDimensionValue(pageContent.getLeftWidth(),pageRoot.getWidth());
  bodyLeft=Math.max(0,bodyLeft);
  bodyLeft=Math.min(pageRoot.getWidth(),bodyLeft);
  body.setPosition(bodyLeft,headerHeight);
  int bodyRight=getDimensionValue(pageContent.getRightWidth(),pageRoot.getWidth());
  bodyRight=Math.max(0,bodyRight);
  bodyRight=Math.min(pageRoot.getWidth() - bodyLeft,bodyRight);
  body.setWidth(pageRoot.getWidth() - bodyLeft - bodyRight);
  body.setHeight(pageRoot.getHeight() - headerHeight - footerHeight);
  page.setBody(body);
  pageRoot.addChild(body);
  if (overFlowType == IPDFRenderOption.CLIP_CONTENT || overFlowType == IPDFRenderOption.OUTPUT_TO_MULTIPLE_PAGES) {
    pageRoot.setNeedClip(true);
    page.getBody().setNeedClip(true);
  }
 else {
    pageRoot.setNeedClip(false);
  }
}

Fixed version (ground truth):
protected void createRoot(){
  currentContext.root=new PageArea(((PageContext)currentContext).pageContent);
  PageArea page=(PageArea)currentContext.root;
  int overFlowType=context.getPageOverflow();
  if (overFlowType == IPDFRenderOption.OUTPUT_TO_MULTIPLE_PAGES) {
  }
  pageContentWidth=getDimensionValue(pageContent.getPageWidth());
  pageContentHeight=getDimensionValue(pageContent.getPageHeight());
  if (pageContentWidth <= 0) {
    pageContentWidth=DEFAULT_PAGE_WIDTH;
  }
  if (pageContentHeight <= 0) {
    pageContentHeight=DEFAULT_PAGE_HEIGHT;
  }
  page.setWidth(pageContentWidth);
  page.setHeight(pageContentHeight);
  ContainerArea pageRoot=(ContainerArea)AreaFactory.createBlockContainer(pageContent);
  rootLeft=getDimensionValue(pageContent.getMarginLeft(),pageContentWidth);
  rootTop=getDimensionValue(pageContent.getMarginTop(),pageContentWidth);
  rootLeft=Math.max(0,rootLeft);
  rootLeft=Math.min(pageContentWidth,rootLeft);
  rootTop=Math.max(0,rootTop);
  rootTop=Math.min(pageContentHeight,rootTop);
  pageRoot.setPosition(rootLeft,rootTop);
  int rootRight=getDimensionValue(pageContent.getMarginRight(),pageContentWidth);
  int rootBottom=getDimensionValue(pageContent.getMarginBottom(),pageContentWidth);
  rootRight=Math.max(0,rootRight);
  rootBottom=Math.max(0,rootBottom);
  if (rootLeft + rootRight > pageContentWidth) {
    rootRight=0;
  }
  if (rootTop + rootBottom > pageContentHeight) {
    rootBottom=0;
  }
  rootWidth=pageContentWidth - rootLeft - rootRight;
  rootHeight=pageContentHeight - rootTop - rootBottom;
  pageRoot.setWidth(rootWidth);
  pageRoot.setHeight(rootHeight);
  page.setRoot(pageRoot);
  int headerHeight=getDimensionValue(pageContent.getHeaderHeight(),pageRoot.getHeight());
  int headerWidth=pageRoot.getWidth();
  IStyle pageStyle=pageContent.getComputedStyle();
  int topBorderWidth=PropertyUtil.getDimensionValue(pageStyle.getProperty(StyleConstants.STYLE_BORDER_TOP_WIDTH));
  int bottomBorderWidth=PropertyUtil.getDimensionValue(pageStyle.getProperty(StyleConstants.STYLE_BORDER_BOTTOM_WIDTH));
  int leftBorderWidth=PropertyUtil.getDimensionValue(pageStyle.getProperty(StyleConstants.STYLE_BORDER_LEFT_WIDTH));
  int rightBorderWidth=PropertyUtil.getDimensionValue(pageStyle.getProperty(StyleConstants.STYLE_BORDER_RIGHT_WIDTH));
  int horizontalBorderWidth=leftBorderWidth + rightBorderWidth;
  headerHeight=Math.max(0,headerHeight);
  headerHeight=Math.min(pageRoot.getHeight(),headerHeight);
  ContainerArea header=new LogicContainerArea(report);
  header.setHeight(headerHeight - topBorderWidth);
  header.setWidth(headerWidth - horizontalBorderWidth);
  header.setPosition(leftBorderWidth,topBorderWidth);
  pageRoot.addChild(header);
  page.setHeader(header);
  int footerHeight=getDimensionValue(pageContent.getFooterHeight(),pageRoot.getHeight());
  int footerWidth=pageRoot.getWidth();
  footerHeight=Math.max(0,footerHeight);
  footerHeight=Math.min(pageRoot.getHeight() - headerHeight,footerHeight);
  ContainerArea footer=new LogicContainerArea(report);
  footer.setHeight(footerHeight - bottomBorderWidth);
  footer.setWidth(footerWidth - horizontalBorderWidth);
  footer.setPosition(leftBorderWidth,pageRoot.getHeight() - footerHeight - bottomBorderWidth);
  pageRoot.addChild(footer);
  page.setFooter(footer);
  ContainerArea body=new LogicContainerArea(report);
  int bodyLeft=getDimensionValue(pageContent.getLeftWidth(),pageRoot.getWidth());
  bodyLeft=Math.max(0,bodyLeft);
  bodyLeft=Math.min(pageRoot.getWidth(),bodyLeft);
  body.setPosition(bodyLeft + leftBorderWidth,headerHeight);
  int bodyRight=getDimensionValue(pageContent.getRightWidth(),pageRoot.getWidth());
  bodyRight=Math.max(0,bodyRight);
  bodyRight=Math.min(pageRoot.getWidth() - bodyLeft,bodyRight);
  body.setWidth(pageRoot.getWidth() - bodyLeft - bodyRight- horizontalBorderWidth);
  body.setHeight(pageRoot.getHeight() - headerHeight - footerHeight);
  page.setBody(body);
  pageRoot.addChild(body);
  if (overFlowType == IPDFRenderOption.CLIP_CONTENT || overFlowType == IPDFRenderOption.OUTPUT_TO_MULTIPLE_PAGES) {
    pageRoot.setNeedClip(true);
    page.getBody().setNeedClip(true);
  }
 else {
    pageRoot.setNeedClip(false);
  }
}