https://bz.apache.org/bugzilla/show_bug.cgi?id=65839

            Bug ID: 65839
           Summary: The resize method takes INFINITY, causing an infinite
                    loop
           Product: POI
           Version: 5.2.0-FINAL
          Hardware: PC
                OS: Mac OS X 10.1
            Status: NEW
          Severity: major
          Priority: P2
         Component: HSSF
          Assignee: [email protected]
          Reporter: [email protected]
  Target Milestone: ---

When the image is damaged, the length and width value of the image is 0, and
the scale may change to INFINITY during calculation, causing the program to
loop endlessly

package org.apache.poi.hssf.usermodel;    
@Override
    public void resize(double scaleX, double scaleY) {
        HSSFClientAnchor anchor = getClientAnchor();
        anchor.setAnchorType(AnchorType.MOVE_DONT_RESIZE);

        HSSFClientAnchor pref = getPreferredSize(scaleX,scaleY);

        int row2 = anchor.getRow1() + (pref.getRow2() - pref.getRow1());
        int col2 = anchor.getCol1() + (pref.getCol2() - pref.getCol1());

        anchor.setCol2((short)col2);
        // anchor.setDx1(0);
        anchor.setDx2(pref.getDx2());

        anchor.setRow2(row2);
        // anchor.setDy1(0);
        anchor.setDy2(pref.getDy2());
    }

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to