Program: 75093
Project: 75093
Buggy source:
protected void createRoot(){
  root=new PageArea(pageContent);
  page=(PageArea)root;
  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);
  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 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);
  pageRoot.setClip(true);
  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);
}