Program: 65051
Project: 65051
Buggy source:
/** 
 * precond: TableGroupArea do not have outside merging in
 * @param table
 */
private void parseTableExtraSpanRows(ContainerArea table){
  int additionalrowheight=0;
  int additionalrowspan=0;
  for (int rowidx=table.getChildrenCount() - 1; rowidx >= 0; rowidx--) {
    ContainerArea child=(ContainerArea)table.getChild(rowidx);
    if (child instanceof TableGroupArea) {
      parseTableExtraSpanRows(child);
    }
 else {
      RowArea row=(RowArea)child;
      if (row.getChildrenCount() == 0) {
        additionalrowheight+=row.getHeight();
        additionalrowspan++;
      }
 else       if (additionalrowspan > 0) {
        row.setHeight(additionalrowheight + row.getHeight());
        Iterator<IArea> iter=row.getChildren();
        while (iter.hasNext()) {
          CellArea cell=(CellArea)iter.next();
          cell.setRowSpan(cell.getRowSpan() - additionalrowspan);
        }
        additionalrowheight=0;
        additionalrowspan=0;
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * precond: TableGroupArea do not have outside merging in
 * @param table
 */
private void parseTableExtraSpanRows(ContainerArea table){
  int additionalrowheight=0;
  int additionalrowspan=0;
  boolean fistrowrun=true;
  for (int rowidx=table.getChildrenCount() - 1; rowidx >= 0; rowidx--) {
    ContainerArea child=(ContainerArea)table.getChild(rowidx);
    if (child instanceof TableGroupArea) {
      parseTableExtraSpanRows(child);
    }
 else {
      RowArea row=(RowArea)child;
      int numOfCells=row.getChildrenCount();
      if (numOfCells == 0) {
        additionalrowheight+=row.getHeight();
        additionalrowspan++;
      }
 else       if (!zeroColumnList.isEmpty()) {
        if (numOfColumns != numOfCells) {
          Iterator<Integer> iterzero=zeroColumnList.iterator();
          Iterator<IArea> itercell=row.getChildren();
          int zerocolumn=iterzero.next();
          while (itercell.hasNext()) {
            CellArea cell=(CellArea)itercell.next();
            int thiscolspan=cell.getColSpan();
            if (thiscolspan > 1) {
              int thiscolumn=cell.getColumnID();
              while (iterzero.hasNext() && zerocolumn < thiscolumn) {
                zerocolumn=iterzero.next();
              }
              while (zerocolumn <= (thiscolumn + thiscolspan - 1)) {
                cell.setColSpan(--thiscolspan);
                if (fistrowrun) {
                  int numOfigncol=0;
                  Integer numofIng=mapignorecolumns.get(thiscolumn);
                  if (numofIng == null) {
                    numOfigncol=1;
                  }
 else {
                    numOfigncol=numofIng + 1;
                  }
                  mapignorecolumns.put(thiscolumn,numOfigncol);
                }
                if (iterzero.hasNext()) {
                  zerocolumn=iterzero.next();
                }
 else {
                  break;
                }
              }
              if (zerocolumn < (thiscolumn + thiscolspan)) {
                break;
              }
            }
          }
        }
      }
 else       if (additionalrowspan > 0) {
        row.setHeight(additionalrowheight + row.getHeight());
        Iterator<IArea> iter=row.getChildren();
        while (iter.hasNext()) {
          CellArea cell=(CellArea)iter.next();
          cell.setRowSpan(cell.getRowSpan() - additionalrowspan);
        }
        additionalrowheight=0;
        additionalrowspan=0;
      }
    }
  }
}