[Libreoffice-commits] core.git: svx/source
Caolán McNamara
caolanm at redhat.com
Tue Nov 14 21:16:22 UTC 2017
svx/source/customshapes/EnhancedCustomShapeFontWork.cxx | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
New commits:
commit b56479e88edeabd6c6fe51cc0095a23543229856
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue Nov 14 21:07:43 2017 +0000
ofz#4211 Integer-overflow
Change-Id: I4e0f2c16d47639362d28d126a399b52d5180f16a
Reviewed-on: https://gerrit.libreoffice.org/44741
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
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 );
More information about the Libreoffice-commits
mailing list