include/basegfx/numeric/ftools.hxx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
New commits: commit dbd9ad421534b7bad6324f0c2a358416c80b4d81 Author: Caolán McNamara <[email protected]> Date: Mon Oct 9 10:03:03 2017 +0100 ofz+ubsan: limit double range to sal_Int32 limits wmf fuzzing Change-Id: I37b437717f064c6c85cd383315adf4e989486412 Reviewed-on: https://gerrit.libreoffice.org/43272 Tested-by: Jenkins <[email protected]> Reviewed-by: Caolán McNamara <[email protected]> Tested-by: Caolán McNamara <[email protected]> diff --git a/include/basegfx/numeric/ftools.hxx b/include/basegfx/numeric/ftools.hxx index 35a1a35111b2..19d8d1722aff 100644 --- a/include/basegfx/numeric/ftools.hxx +++ b/include/basegfx/numeric/ftools.hxx @@ -22,7 +22,7 @@ #include <rtl/math.hxx> #include <basegfx/basegfxdllapi.h> - +#include <limits> // standard PI defines from solar.h, but we do not want to link against tools @@ -59,6 +59,10 @@ namespace basegfx */ inline sal_Int32 fround( double fVal ) { + if (fVal >= std::numeric_limits<sal_Int32>::max()) + return std::numeric_limits<sal_Int32>::max(); + else if (fVal <= std::numeric_limits<sal_Int32>::min()) + return std::numeric_limits<sal_Int32>::min(); return fVal > 0.0 ? static_cast<sal_Int32>( fVal + .5 ) : -static_cast<sal_Int32>( -fVal + .5 ); }
_______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
