[Libreoffice-commits] core.git: sw/source

Stephan Bergmann sbergman at redhat.com
Wed Jan 24 14:53:57 UTC 2018


 sw/source/filter/ww8/ww8scan.cxx |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 1bf5b5b76dc1e244c0cf871740c66794157561bd
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Jan 23 17:00:27 2018 +0100

    This presumably always wanted to check for SAL_MAX_UINT16, not USHRT_MAX
    
    The check against USHRT_MAX was introduced with
    9c0344627f1767512ef5097c08e3ed7500d223da "INTEGRATION: CWS cmcfixes30: #i72614#
    crash in loading corrupt .doc", apparently to ensure the static_cast<sal_uInt16>
    in the call to ShortToSVBT16 below (which already was that same
    static_cast<sal_uInt16> back tehn) is OK.
    
    Change-Id: Ie385f0f490cab1c59bce07fa25bd9b92e3ad286a
    Reviewed-on: https://gerrit.libreoffice.org/48439
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx
index 03696fb5208f..faa04a594f1a 100644
--- a/sw/source/filter/ww8/ww8scan.cxx
+++ b/sw/source/filter/ww8/ww8scan.cxx
@@ -2305,8 +2305,9 @@ void WW8PLCF::GeneratePLCF(SvStream& rSt, sal_Int32 nPN, sal_Int32 ncpN)
 
     if (!failure)
     {
+        // Check arguments to ShortToSVBT16 in loop below will all be valid:
         sal_Int32 nResult;
-        failure = o3tl::checked_add(nPN, ncpN, nResult) || nResult > USHRT_MAX;
+        failure = o3tl::checked_add(nPN, ncpN, nResult) || nResult > SAL_MAX_UINT16;
     }
 
     if (!failure)


More information about the Libreoffice-commits mailing list