[Libreoffice-commits] .: Branch 'libreoffice-3-4-0' - sw/source

Petr Mladek pmladek at kemper.freedesktop.org
Tue May 24 09:19:41 PDT 2011


 sw/source/core/crsr/bookmrk.cxx |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit d08385dd9a75cdf0b970fa4f2ffe4b822d4d5b2b
Author: Cédric Bosdonnat <cedric.bosdonnat.ooo at free.fr>
Date:   Thu May 19 12:40:09 2011 +0200

    fdo#36329: Fix crash reading some documents with fields
    
    The problem came from the unsigned integer positions... Needed to
    prevent the end position to get -1/max value.
    
    Signed-off-by: Petr Mladek <pmladek at suse.cz>
    Signed-off-by: Tor Lillqvist <tlillqvist at novell.com>
    Signed-off-by: Michael Meeks <michael.meeks at novell.com>

diff --git a/sw/source/core/crsr/bookmrk.cxx b/sw/source/core/crsr/bookmrk.cxx
index 0619118..2b2af4f 100644
--- a/sw/source/core/crsr/bookmrk.cxx
+++ b/sw/source/core/crsr/bookmrk.cxx
@@ -84,7 +84,8 @@ namespace
             rStart.nNode.GetNode().GetTxtNode();
         SwTxtNode const*const pEndTxtNode = rEnd.nNode.GetNode().GetTxtNode();
         const sal_Unicode ch_start=pStartTxtNode->GetTxt().GetChar(rStart.nContent.GetIndex());
-        xub_StrLen nEndPos = rEnd == rStart ? rEnd.nContent.GetIndex() : rEnd.nContent.GetIndex() - 1;
+        xub_StrLen nEndPos = ( rEnd == rStart ||  rEnd.nContent.GetIndex() == 0 ) ?
+            rEnd.nContent.GetIndex() : rEnd.nContent.GetIndex() - 1;
         const sal_Unicode ch_end=pEndTxtNode->GetTxt().GetChar( nEndPos );
         SwPaM aStartPaM(rStart);
         SwPaM aEndPaM(rEnd);


More information about the Libreoffice-commits mailing list