diff options
author | Caolán McNamara <caolanm@redhat.com> | 2017-10-30 20:24:47 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2017-10-31 09:42:30 +0100 |
commit | 13d79459e5d30b927f50885d42f7ce404124a2d0 (patch) | |
tree | a94c23a2653951122c476c7d62ef50fd929611fe /filter | |
parent | 3ad6957dc12c0667a69ca6b8361ccde490f9c1da (diff) |
ofz#3931 Integer-overflow
Change-Id: Iab9e4c300e0b860d7fac5274b7ca6345c56343f8
Reviewed-on: https://gerrit.libreoffice.org/44072
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'filter')
-rw-r--r-- | filter/source/msfilter/msdffimp.cxx | 11 |
1 files changed, 6 insertions, 5 deletions
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; |