[Libreoffice-commits] .: Branch 'libreoffice-3-4' - 2 commits - sw/source

Michael Meeks michael at kemper.freedesktop.org
Fri Jul 8 04:38:23 PDT 2011


 sw/source/filter/ww8/ww8par.cxx  |   13 ++++++++++---
 sw/source/filter/ww8/ww8par3.cxx |    6 ++++--
 2 files changed, 14 insertions(+), 5 deletions(-)

New commits:
commit 4f7ce10128216e93ef8953fa396be6dca23eb335
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Jun 20 23:43:32 2011 +0100

    Resolves: #i105349# protect against missing insertion position
    
    Signed-off-by: Michael Meeks <michael.meeks at novell.com>

diff --git a/sw/source/filter/ww8/ww8par3.cxx b/sw/source/filter/ww8/ww8par3.cxx
index bbc99af..2f108cf 100644
--- a/sw/source/filter/ww8/ww8par3.cxx
+++ b/sw/source/filter/ww8/ww8par3.cxx
@@ -1780,10 +1780,12 @@ void SwWW8ImplReader::RegisterNumFmtOnTxtNode(sal_uInt16 nActLFO,
 
     if (pLstManager) // sind die Listendeklarationen gelesen?
     {
-        std::vector<sal_uInt8> aParaSprms;
         SwTxtNode* pTxtNd = pPaM->GetNode()->GetTxtNode();
-        OSL_ENSURE(pTxtNd, "Kein Text-Node an PaM-Position");
+        OSL_ENSURE(pTxtNd, "No Text-Node at PaM-Position");
+        if (!pTxtNd)
+            return;
 
+        std::vector<sal_uInt8> aParaSprms;
         const SwNumRule* pRule = bSetAttr ?
             pLstManager->GetNumRuleForActivation( nActLFO, nActLevel,
                 aParaSprms, pTxtNd) : 0;
commit cf65ab392673024f34eedb27f6002b6da86504c3
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Jun 23 12:45:44 2011 +0100

    Resolves: #i95550# handle wrong text len gracefully
    
    Signed-off-by: Michael Meeks <michael.meeks at novell.com>

diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index 163b078..0ff27b1 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() :


More information about the Libreoffice-commits mailing list