tools/source/generic/fract.cxx | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
New commits: commit db00a6d4d9935f4905c70d826b27139221e4a1c7 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Sat Apr 10 16:17:01 2021 +0100 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Sat Apr 10 20:19:23 2021 +0200 ofz#32973 Integer-overflow Change-Id: Ib290468b4c7388b80da627138435b98feaed354b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113921 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> diff --git a/tools/source/generic/fract.cxx b/tools/source/generic/fract.cxx index d4c4fe11c319..7c0e850db8d7 100644 --- a/tools/source/generic/fract.cxx +++ b/tools/source/generic/fract.cxx @@ -427,8 +427,15 @@ static void rational_ReduceInaccurate(boost::rational<sal_Int32>& rRational, uns return; // http://www.boost.org/doc/libs/release/libs/rational/rational.html#Internal%20representation - const bool bNeg = ( rRational.numerator() < 0 ); - sal_Int32 nMul = bNeg? -rRational.numerator(): rRational.numerator(); + sal_Int32 nMul = rRational.numerator(); + if (nMul == std::numeric_limits<sal_Int32>::min()) + { + // ofz#32973 Integer-overflow + return; + } + const bool bNeg = nMul < 0; + if (bNeg) + nMul = -nMul; sal_Int32 nDiv = rRational.denominator(); DBG_ASSERT(nSignificantBits<65, "More than 64 bit of significance is overkill!"); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits