Date: prev next · Thread: first prev next last
2011 Archives by date, by thread · List index


Hi all,

could you please review / push this patch to 3.4 and 3.4.0? It's a
simple fix that would save quite some crashes.

Thanks,

-- 
Cédric Bosdonnat
LibreOffice hacker
http://documentfoundation.org
OOo Eclipse Integration developer
http://cedric.bosdonnat.free.fr
From dad2c6ac2dba139364b93cb75a5d2a1b354b65a7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?C=C3=A9dric=20Bosdonnat?= <cedric.bosdonnat.ooo@free.fr>
Date: Thu, 19 May 2011 12:40:09 +0200
Subject: [PATCH] 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.
---
 sw/source/core/crsr/bookmrk.cxx |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

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);
-- 
1.7.3.4


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.