summaryrefslogtreecommitdiff
path: root/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2017-11-14 21:07:43 +0000
committerCaolán McNamara <caolanm@redhat.com>2017-11-14 22:15:37 +0100
commitb56479e88edeabd6c6fe51cc0095a23543229856 (patch)
treec9e0eb46db299e05ea3a74a3db05a19c55f98e12 /svx/source/customshapes/EnhancedCustomShapeFontWork.cxx
parent27e4a3c4e364d1858eb3e77348ee78c6c6d33cf1 (diff)
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>
Diffstat (limited to 'svx/source/customshapes/EnhancedCustomShapeFontWork.cxx')
-rw-r--r--svx/source/customshapes/EnhancedCustomShapeFontWork.cxx11
1 files changed, 8 insertions, 3 deletions
diff --git a/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx b/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx
index 68f796178d8a..3b0238e8705d 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 );