diff options
author | Caolán McNamara <caolanm@redhat.com> | 2011-06-23 12:45:44 +0100 |
---|---|---|
committer | Michael Meeks <michael.meeks@novell.com> | 2011-07-08 12:32:38 +0100 |
commit | cf65ab392673024f34eedb27f6002b6da86504c3 (patch) | |
tree | 0dc1e37998974777bcc5111328e59799acf08557 | |
parent | 410105ca3c9ec448e162d66a072ffd2b2b42424f (diff) |
Resolves: #i95550# handle wrong text len gracefully
Signed-off-by: Michael Meeks <michael.meeks@novell.com>
-rw-r--r-- | sw/source/filter/ww8/ww8par.cxx | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index 163b078029..0ff27b1b42 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -2627,9 +2627,6 @@ bool SwWW8ImplReader::ReadPlainChars(WW8_CP& rPos, long nEnd, long nCpOfs) // Unicode-Flag neu setzen und notfalls File-Pos korrigieren // merke: Seek kostet nicht viel, da inline geprueft wird, // ob die korrekte FilePos nicht schon erreicht ist. - WW8_FC nStreamPos = pSBase->WW8Cp2Fc(nCpOfs+rPos, &bIsUnicode); - pStrm->Seek( nStreamPos ); - xub_StrLen nLen; if (nEnd - rPos <= (STRING_MAXLEN-1)) nLen = writer_cast<xub_StrLen>(nEnd - rPos); @@ -2639,6 +2636,16 @@ bool SwWW8ImplReader::ReadPlainChars(WW8_CP& rPos, long nEnd, long nCpOfs) if (!nLen) return true; + sal_Size nRequestedPos = pSBase->WW8Cp2Fc(nCpOfs+rPos, &bIsUnicode); + sal_Size nSeekedPos = pStrm->Seek(nRequestedPos); + OSL_ENSURE(nRequestedPos == nSeekedPos, "Document claimed to have more text than available"); + if (nRequestedPos != nSeekedPos) + { + //Swallow missing range, e.g. #i95550# + rPos+=nLen; + return true; + } + const CharSet eSrcCharSet = bVer67 ? GetCurrentCharSet() : RTL_TEXTENCODING_MS_1252; const CharSet eSrcCJKCharSet = bVer67 ? GetCurrentCJKCharSet() : |