include/tools/helpers.hxx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
New commits: commit 06533a4b9d2d249e2e16c6870de9ff29d590bb96 Author: Caolán McNamara <caol...@redhat.com> Date: Wed Oct 25 13:07:33 2017 +0100 ofz#3797 Integer-overflow Change-Id: Iff545f441f2cf5e4f7626a6deff0ee0136c3af6b Reviewed-on: https://gerrit.libreoffice.org/43829 Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> diff --git a/include/tools/helpers.hxx b/include/tools/helpers.hxx index 858ec4f7fc50..30064cf93fc6 100644 --- a/include/tools/helpers.hxx +++ b/include/tools/helpers.hxx @@ -10,6 +10,7 @@ #define INCLUDED_TOOLS_HELPERS_HXX #include <sal/config.h> +#include <sal/types.h> #include <cassert> #include <type_traits> @@ -40,9 +41,13 @@ MinMax(T nVal, long nMin, long nMax) : nMin); } -inline long AlignedWidth4Bytes( long nWidthBits ) +inline sal_uInt32 AlignedWidth4Bytes(sal_uInt32 nWidthBits) { - return ( ( nWidthBits + 31 ) >> 5 ) << 2; + if (nWidthBits > SAL_MAX_UINT32 - 31) + nWidthBits = SAL_MAX_UINT32; + else + nWidthBits += 31; + return (nWidthBits >> 5) << 2; } inline long FRound( double fVal )
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits