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:16:15 +0200 |
commit | e11d6076cd88b219e0bace8caac791e2e780f257 (patch) | |
tree | 49969ec5a3123f28ec0371cefddb4e6198bb4616 | |
parent | 27875f65e2c1953fbf636af32556833c44849f53 (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>
-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 06191188da..2b2af4fc79 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); |