[Libreoffice-commits] core.git: Branch 'libreoffice-5-0' - sw/qa sw/source

Caolán McNamara caolanm at redhat.com
Fri Aug 21 07:32:09 PDT 2015


 sw/qa/core/data/ww6/pass/crash-1.doc |binary
 sw/qa/core/filters-test.cxx          |    4 ++++
 sw/source/filter/ww8/ww8par2.cxx     |   29 ++++++++++++++++-------------
 3 files changed, 20 insertions(+), 13 deletions(-)

New commits:
commit 1e0262584fd4e9e31b9dc00783e9698c29f40ca0
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Aug 21 09:52:29 2015 +0100

    add ww6 test dir and fix a crash
    
    Change-Id: Id08176640672095c03e0b124cd65a9dce26ac2db
    (cherry picked from commit 42a709d1ef647aab9a1c9422b4e25ecaee857aba)
    Reviewed-on: https://gerrit.libreoffice.org/17892
    Reviewed-by: David Tardon <dtardon at redhat.com>
    Tested-by: David Tardon <dtardon at redhat.com>

diff --git a/sw/qa/core/data/ww6/fail/.gitignore b/sw/qa/core/data/ww6/fail/.gitignore
new file mode 100644
index 0000000..e69de29
diff --git a/sw/qa/core/data/ww6/indeterminate/.gitignore b/sw/qa/core/data/ww6/indeterminate/.gitignore
new file mode 100644
index 0000000..e69de29
diff --git a/sw/qa/core/data/ww6/pass/.gitignore b/sw/qa/core/data/ww6/pass/.gitignore
new file mode 100644
index 0000000..e69de29
diff --git a/sw/qa/core/data/ww6/pass/crash-1.doc b/sw/qa/core/data/ww6/pass/crash-1.doc
new file mode 100644
index 0000000..3c6f684
Binary files /dev/null and b/sw/qa/core/data/ww6/pass/crash-1.doc differ
diff --git a/sw/qa/core/filters-test.cxx b/sw/qa/core/filters-test.cxx
index 023b50d9a..077a95e 100644
--- a/sw/qa/core/filters-test.cxx
+++ b/sw/qa/core/filters-test.cxx
@@ -151,6 +151,10 @@ void SwFiltersTest::testCVEs()
             getURLFromSrc("/sw/qa/core/data/ww8/"),
             OUString(FILTER_WW8));
 
+    testDir(OUString("MS WinWord 6.0"),
+            getURLFromSrc("/sw/qa/core/data/ww6/"),
+            OUString(sWW6));
+
     testDir(OUString("MS WinWord 5"),
             getURLFromSrc("/sw/qa/core/data/ww5/"),
             OUString(sWW5));
diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx
index 8929c44..f6df99f 100644
--- a/sw/source/filter/ww8/ww8par2.cxx
+++ b/sw/source/filter/ww8/ww8par2.cxx
@@ -4276,6 +4276,14 @@ void WW8RStyle::ImportOldFormatStyles()
     std::vector< std::vector<sal_uInt8> > aConvertedChpx;
     while (nByteCount < cbChpx)
     {
+        if (stcp == aCHPXOffsets.size())
+        {
+            //more data than style slots, skip remainder
+            rSt.SeekRel(cbChpx-nByteCount);
+            nByteCount += cbChpx-nByteCount;
+            break;
+        }
+
         sal_uInt8 cb(0);
         rSt.ReadUChar( cb );
         nByteCount++;
@@ -4298,12 +4306,7 @@ void WW8RStyle::ImportOldFormatStyles()
         else
             aConvertedChpx.push_back( std::vector<sal_uInt8>() );
 
-        stcp++;
-        if (stcp == nStyles)
-        {
-            rSt.SeekRel(cbChpx-nByteCount);
-            nByteCount += cbChpx-nByteCount;
-        }
+        ++stcp;
     }
 
     std::vector<pxoffset> aPAPXOffsets(stcp);
@@ -4320,6 +4323,12 @@ void WW8RStyle::ImportOldFormatStyles()
     stcp=0;
     while (nByteCount < cbPapx)
     {
+        if (stcp == aPAPXOffsets.size())
+        {
+            rSt.SeekRel(cbPapx-nByteCount);
+            nByteCount += cbPapx-nByteCount;
+        }
+
         sal_uInt8 cb(0);
         rSt.ReadUChar( cb );
         nByteCount++;
@@ -4341,13 +4350,7 @@ void WW8RStyle::ImportOldFormatStyles()
             nByteCount += nRemainder;
         }
 
-        stcp++;
-
-        if (stcp == nStyles)
-        {
-            rSt.SeekRel(cbPapx-nByteCount);
-            nByteCount += cbPapx-nByteCount;
-        }
+        ++stcp;
     }
 
     sal_uInt16 iMac(0);


More information about the Libreoffice-commits mailing list