emfio/source/reader/mtftools.cxx | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)
New commits: commit 7137a52a8d04f0507b536b74ee00a69b66649788 Author: Caolán McNamara <caolan.mcnam...@collabora.com> AuthorDate: Sat Apr 20 16:28:46 2024 +0100 Commit: Caolán McNamara <caolan.mcnam...@collabora.com> CommitDate: Sat Apr 20 21:25:13 2024 +0200 ofz#68172 Integer-overflow Change-Id: Ie80487e20217d7a54cb401b0423dfec01df1292e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166373 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com> diff --git a/emfio/source/reader/mtftools.cxx b/emfio/source/reader/mtftools.cxx index e6ac4893730b..40b040820960 100644 --- a/emfio/source/reader/mtftools.cxx +++ b/emfio/source/reader/mtftools.cxx @@ -975,10 +975,18 @@ namespace emfio if ( pLineStyle->aLineInfo.GetStyle() == LineStyle::Dash ) { aSize.AdjustWidth(1 ); - tools::Long nDotLen = ImplMap( aSize ).Width(); - pLineStyle->aLineInfo.SetDistance( nDotLen ); - pLineStyle->aLineInfo.SetDotLen( nDotLen ); - pLineStyle->aLineInfo.SetDashLen( nDotLen * 3 ); + tools::Long nDashLen, nDotLen = ImplMap( aSize ).Width(); + const bool bFail = o3tl::checked_multiply<tools::Long>(nDotLen, 3, nDashLen); + if (!bFail) + { + pLineStyle->aLineInfo.SetDistance( nDotLen ); + pLineStyle->aLineInfo.SetDotLen( nDotLen ); + pLineStyle->aLineInfo.SetDashLen( nDotLen * 3 ); + } + else + { + SAL_WARN("emfio", "DotLen too long: " << nDotLen); + } } } }