diff options
author | Cédric Bosdonnat <cedric.bosdonnat.ooo@free.fr> | 2011-05-19 12:40:09 +0200 |
---|---|---|
committer | Petr Mladek <pmladek@suse.cz> | 2011-05-24 18:18:40 +0200 |
commit | eba460df884390d004ad66a2a2a1fedda9be4410 (patch) | |
tree | f58a7187174e0460309519b5bda1b91172c8172c | |
parent | 1fb1b68fbcc67e98af697fb602ee6fdbe35d35e8 (diff) |
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@suse.cz>
Signed-off-by: Tor Lillqvist <tlillqvist@novell.com>
Signed-off-by: Michael Meeks <michael.meeks@novell.com>
-rw-r--r-- | 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 30039539de96..3c039f917d4a 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); |