From f8cf0d2cb4e5e18f48d6b3bfbc7d0e72e7ed5190 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Mon, 6 Sep 2021 13:25:45 +0200 Subject: tdf#144319 fix formula load regression from commit 67d83e40e2c4f3862c50e6abeabfc24a75119fc8 Author: Noel Grandin Date: Sat Dec 19 13:25:53 2020 +0200 speedup rational_FromDouble Change-Id: Icb728b63f950e827f1492087114f927c2f85ddb9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121719 Tested-by: Jenkins Tested-by: Xisco Fauli Reviewed-by: Xisco Fauli Reviewed-by: Noel Grandin --- tools/source/generic/fract.cxx | 3 +++ 1 file changed, 3 insertions(+) (limited to 'tools') diff --git a/tools/source/generic/fract.cxx b/tools/source/generic/fract.cxx index 7c0e850db8d7..57dd4e79c138 100644 --- a/tools/source/generic/fract.cxx +++ b/tools/source/generic/fract.cxx @@ -43,6 +43,9 @@ static boost::rational toRational(sal_Int32 n, sal_Int32 d) // https://github.com/boostorg/boost/issues/335 when these are std::numeric_limits::min if (n == d) return 1; + // tdf#144319 avoid boost::bad_rational e.g. if numerator=-476741369, denominator=-2147483648 + if (d < -std::numeric_limits::max()) + return 0; return boost::rational(n, d); } -- cgit