[PATCH] fdo#36329: Fix crash reading some documents with fields
Cédric Bosdonnat
cedric.bosdonnat.ooo at free.fr
Thu May 19 03:40:09 PDT 2011
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
--=-ofv6cWtEuLA6Nr9biu1A--
More information about the LibreOffice
mailing list