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

Stephan Bergmann sbergman at redhat.com
Tue Feb 11 06:03:25 PST 2014


 sw/source/core/text/txtfrm.cxx |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit f12b902d976096b7e2933fddf74e0f4987e35c6c
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Feb 11 14:53:44 2014 +0100

    Fix the -Werror=strict-overflow correctly
    
    ...from 2bf2dee04c1d698e586316c2bd18a3e34df4be77 "Werror=strict-overflow."  The
    warning (generated e.g. by --disable-debug --disable-dbgutil builds with
    GCC 4.8.2) orginates from the call to
    
      InvalidateRange( SwCharRange( GetOfst(), COMPLETE_STRING ) );
    
    in SwTxtFrm::Prepare further down in txtfrm.cxx, which inlines the IsIdxInside
    code to
    
      if( GetOfst() > GetOfst() + COMPLETE_STRING )
    
    where COMPLETE_STRING is SAL_MAX_INT32.  The problem is that before
    ba27366f3d6bc6b209ecd5c5cb79a9ee5315316a "Resolves: #i17171# Writer paragraph
    cannot be longer than 65534 characters" that code would inline to
    
      if( GetOfst() > GetOfst() + STRING_LEN )
    
    where STRING_LEN was 0xFFFF, so the calculation on effectively 16-bit quantities
    stayed nicely in the bounds of (32-bit) int.
    
    Change-Id: I958514e52e9102236844eefa4fe92a401be6ab01

diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx
index 9a2aa38..12124a7 100644
--- a/sw/source/core/text/txtfrm.cxx
+++ b/sw/source/core/text/txtfrm.cxx
@@ -673,7 +673,7 @@ sal_Int32 SwTxtFrm::FindBrk( const OUString &rTxt,
 
 sal_Bool SwTxtFrm::IsIdxInside( const sal_Int32 nPos, const sal_Int32 nLen ) const
 {
-    if( nPos + nLen < 0 || GetOfst() > nPos + nLen ) // the range preceded us
+    if( nLen != COMPLETE_STRING && GetOfst() > nPos + nLen ) // the range preceded us
         return sal_False;
 
     if( !GetFollow() )            // the range doesn't precede us,


More information about the Libreoffice-commits mailing list