ofz#4211 Integer-overflow

Change-Id: I4e0f2c16d47639362d28d126a399b52d5180f16a
Reviewed-on: https://gerrit.libreoffice.org/44741
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
diff --git a/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx b/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx
index 68f7961..3b0238e 100644
--- a/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx
+++ b/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx
@@ -413,7 +413,7 @@ void GetTextAreaOutline( const FWData& rFWData, const SdrObject* pCustomShape, F
    }
}

void GetFontWorkOutline( FWData& rFWData, const SdrObject* pCustomShape )
bool GetFontWorkOutline(FWData& rFWData, const SdrObject* pCustomShape)
{
    SdrTextHorzAdjust eHorzAdjust( static_cast<const SdrTextHorzAdjustItem&>(pCustomShape->GetMergedItem( SDRATTR_TEXT_HORZADJUST )).GetValue() );
    drawing::TextFitToSizeType const eFTS( static_cast<const SdrTextFitToSizeTypeItem&>(pCustomShape->GetMergedItem( SDRATTR_TEXT_FITTOSIZE )).GetValue() );
@@ -424,6 +424,9 @@ void GetFontWorkOutline( FWData& rFWData, const SdrObject* pCustomShape )
    rFWData.nSingleLineHeight = (sal_Int32)( ( (double)pCustomShape->GetLogicRect().GetHeight()
                                                / rFWData.nMaxParagraphsPerTextArea ) * rFWData.fHorizontalTextScaling );

    if (rFWData.nSingleLineHeight == SAL_MIN_INT32)
        return false;

    bool bSameLetterHeights = false;
    const SdrCustomShapeGeometryItem& rGeometryItem = static_cast<const SdrCustomShapeGeometryItem&>(pCustomShape->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ));
    const css::uno::Any* pAny = rGeometryItem.GetPropertyValueByName( "TextPath", "SameLetterHeights" );
@@ -507,6 +510,8 @@ void GetFontWorkOutline( FWData& rFWData, const SdrObject* pCustomShape )
        }
        ++aTextAreaIter;
    }

    return true;
}

basegfx::B2DPolyPolygon GetOutlinesFromShape2d( const SdrObject* pShape2d )
@@ -867,8 +872,8 @@ SdrObject* EnhancedCustomShapeFontWork::CreateFontWork( const SdrObject* pShape2
            CalculateHorizontalScalingFactor( pCustomShape, aFWData, aOutlines2d );

            /* retrieving the Outlines for the each Paragraph. */

            GetFontWorkOutline( aFWData, pCustomShape );
            if (!GetFontWorkOutline(aFWData, pCustomShape))
                return nullptr;

            FitTextOutlinesToShapeOutlines( aOutlines2d, aFWData );