sw/source/core/fields/cellfml.cxx |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit ab6d3b3794f64b6dde8e9309f4fd99051aecbda3
Author: Stephan Bergmann <sberg...@redhat.com>
Date:   Tue Jan 23 17:52:41 2018 +0100

    Remove presumably dead < USHRT_MAX checks
    
    The original code of 84a3db80b4fd66c6854b3135b5f69b61fd828e62 "initial 
import"
    read
    
    +        long nBoxOffset = lcl_GetLongBoxNum( sGetName ) + nSttBox;
    +        long nLineOffset = lcl_GetLongBoxNum( sGetName ) + nSttLine;
    +
    +        if( nBoxOffset < 0 || nBoxOffset >= USHRT_MAX ||
    +            nLineOffset < 0 || nLineOffset >= USHRT_MAX )
    +            return 0;
    +
    +        if( nLineOffset >= long(pLines->Count()) )
    +            return 0;
    +
    +        pLine = (*pLines)[ USHORT(nLineOffset) ];
    +
    +        // dann suche die Box
    +        pBoxes = &pLine->GetTabBoxes();
    +        if( nBoxOffset >= long(pBoxes->Count()) )
    +            return 0;
    +        pBox = (*pBoxes)[ USHORT(nBoxOffset) ];
    
    casting nBox/LineOffset to USHORT, while the current code looks like it 
should
    work fine for larger values.
    
    Change-Id: I47bdf3963be6e84568a589711ce688b66f325db8
    Reviewed-on: https://gerrit.libreoffice.org/48451
    Tested-by: Jenkins <c...@libreoffice.org>
    Reviewed-by: Stephan Bergmann <sberg...@redhat.com>

diff --git a/sw/source/core/fields/cellfml.cxx 
b/sw/source/core/fields/cellfml.cxx
index ea2a4eaef9ca..f32b330b3413 100644
--- a/sw/source/core/fields/cellfml.cxx
+++ b/sw/source/core/fields/cellfml.cxx
@@ -782,8 +782,8 @@ static const SwTableBox* lcl_RelToBox( const SwTable& 
rTable,
         const sal_Int32 nBoxOffset = lcl_GetLongBoxNum( sGetName ) + nSttBox;
         const sal_Int32 nLineOffset = lcl_GetLongBoxNum( sGetName ) + nSttLine;
 
-        if( nBoxOffset < 0 || nBoxOffset >= USHRT_MAX ||
-            nLineOffset < 0 || nLineOffset >= USHRT_MAX )
+        if( nBoxOffset < 0 ||
+            nLineOffset < 0 )
             return nullptr;
 
         if( static_cast<size_t>(nLineOffset) >= pLines->size() )
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to