[Libreoffice-commits] core.git: filter/source
Caolán McNamara
caolanm at redhat.com
Tue Oct 31 08:42:56 UTC 2017
filter/source/msfilter/msdffimp.cxx | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
New commits:
commit 13d79459e5d30b927f50885d42f7ce404124a2d0
Author: Caolán McNamara <caolanm at redhat.com>
Date: Mon Oct 30 20:24:47 2017 +0000
ofz#3931 Integer-overflow
Change-Id: Iab9e4c300e0b860d7fac5274b7ca6345c56343f8
Reviewed-on: https://gerrit.libreoffice.org/44072
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx
index f2d424de9f02..c4786ff88d86 100644
--- a/filter/source/msfilter/msdffimp.cxx
+++ b/filter/source/msfilter/msdffimp.cxx
@@ -928,15 +928,16 @@ void DffPropertyReader::ApplyLineAttributes( SfxItemSet& rSet, const MSO_SPT eSh
}
MSO_LineDashing eLineDashing = (MSO_LineDashing)GetPropertyValue( DFF_Prop_lineDashing, mso_lineSolid );
- if ( eLineDashing == mso_lineSolid )
+ if (eLineDashing == mso_lineSolid || nLineWidth < 0)
rSet.Put(XLineStyleItem( drawing::LineStyle_SOLID ) );
else
{
sal_uInt16 nDots = 1;
sal_uInt32 nDotLen = nLineWidth / 360;
sal_uInt16 nDashes = 0;
- sal_uInt32 nDashLen = ( 8 * nLineWidth ) / 360;
- sal_uInt32 nDistance = ( 3 * nLineWidth ) / 360;
+ const bool bHugeWidth = static_cast<sal_uInt32>(nLineWidth) >= SAL_MAX_UINT32/8U; //then rougher approx is fine
+ sal_uInt32 nDashLen = bHugeWidth ? (nDotLen * 8U) : ((8U * nLineWidth) / 360);
+ sal_uInt32 nDistance = bHugeWidth ? (nDotLen * 3U) : ((3U * nLineWidth) / 360);
switch ( eLineDashing )
{
@@ -953,7 +954,7 @@ void DffPropertyReader::ApplyLineAttributes( SfxItemSet& rSet, const MSO_SPT eSh
{
nDots = 0;
nDashes = 1;
- nDashLen = ( 4 * nLineWidth ) / 360;
+ nDashLen = bHugeWidth ? (nDotLen * 4U) : ((4U * nLineWidth) / 360);
}
break;
@@ -961,7 +962,7 @@ void DffPropertyReader::ApplyLineAttributes( SfxItemSet& rSet, const MSO_SPT eSh
{
nDots = 1;
nDashes = 1;
- nDashLen = ( 4 * nLineWidth ) / 360;
+ nDashLen = bHugeWidth ? (nDotLen * 4U) : ((4U * nLineWidth) / 360);
}
break;
More information about the Libreoffice-commits
mailing list