Program: 73932
Project: 73932
Buggy source:
protected void createRoot(){
  root=new PageArea(pageContent);
  page=(PageArea)root;
  int overFlowType=context.getPageOverflow();
  if (overFlowType == IPDFRenderOption.OUTPUT_TO_MULTIPLE_PAGES) {
    page.setExtendToMultiplePages(true);
  }
  int pageWidth=getDimensionValue(pageContent.getPageWidth());
  int pageHeight=getDimensionValue(pageContent.getPageHeight());
  if (pageWidth <= 0) {
    pageWidth=DEFAULT_PAGE_WIDTH;
  }
  if (pageHeight <= 0) {
    pageHeight=DEFAULT_PAGE_HEIGHT;
  }
  page.setWidth(pageWidth);
  page.setHeight(pageHeight);
  ContainerArea pageRoot=new LogicContainerArea(report);
  if (overFlowType == IPDFRenderOption.CLIP_CONTENT) {
    pageRoot.setNeedClip(true);
  }
 else {
    pageRoot.setNeedClip(false);
  }
  int rootLeft=getDimensionValue(pageContent.getMarginLeft(),pageWidth);
  int rootTop=getDimensionValue(pageContent.getMarginTop(),pageWidth);
  rootLeft=Math.max(0,rootLeft);
  rootLeft=Math.min(pageWidth,rootLeft);
  rootTop=Math.max(0,rootTop);
  rootTop=Math.min(pageHeight,rootTop);
  pageRoot.setPosition(rootLeft,rootTop);
  int rootRight=getDimensionValue(pageContent.getMarginRight(),pageWidth);
  int rootBottom=getDimensionValue(pageContent.getMarginBottom(),pageWidth);
  rootRight=Math.max(0,rootRight);
  rootBottom=Math.max(0,rootBottom);
  if (rootLeft + rootRight > pageWidth) {
    rootRight=0;
  }
  if (rootTop + rootBottom > pageHeight) {
    rootBottom=0;
  }
  pageRoot.setWidth(pageWidth - rootLeft - rootRight);
  pageRoot.setHeight(pageHeight - rootTop - rootBottom);
  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);
}

Fixed version (ground truth):
protected void createRoot(){
  root=new PageArea(pageContent);
  page=(PageArea)root;
  int overFlowType=context.getPageOverflow();
  if (overFlowType == IPDFRenderOption.OUTPUT_TO_MULTIPLE_PAGES) {
    page.setExtendToMultiplePages(true);
  }
  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);
  if (overFlowType == IPDFRenderOption.CLIP_CONTENT) {
    pageRoot.setNeedClip(true);
  }
 else {
    pageRoot.setNeedClip(false);
  }
  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);
}