[Libreoffice-commits] core.git: sot/qa sot/source

Caolán McNamara caolanm at redhat.com
Fri Sep 22 16:00:41 UTC 2017


 sot/qa/cppunit/data/pass/next-page-1.compound |binary
 sot/source/sdstor/stgstrms.cxx                |   22 ++++++++++++++++++----
 2 files changed, 18 insertions(+), 4 deletions(-)

New commits:
commit e0c9088315981e9ee2743ce03ffb6c3b20980c8b
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Sep 22 12:51:39 2017 +0100

    ofz#2976 timeout in olefuzzer
    
    Change-Id: Ic64e5eaa6b524403e46f9907499b0b853792a971
    Reviewed-on: https://gerrit.libreoffice.org/42640
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sot/qa/cppunit/data/pass/next-page-1.compound b/sot/qa/cppunit/data/pass/next-page-1.compound
new file mode 100644
index 000000000000..8a187a3bade8
Binary files /dev/null and b/sot/qa/cppunit/data/pass/next-page-1.compound differ
diff --git a/sot/source/sdstor/stgstrms.cxx b/sot/source/sdstor/stgstrms.cxx
index a60b13db55b7..1ecdc042f351 100644
--- a/sot/source/sdstor/stgstrms.cxx
+++ b/sot/source/sdstor/stgstrms.cxx
@@ -429,13 +429,27 @@ bool StgStrm::Pos2Page( sal_Int32 nBytePos )
         sal_Int32 nBgn = m_aPagesCache.back();
 
         // Start adding pages while we can
-        while( nToAdd > 0 && nBgn >= 0 )
+        while (nToAdd > 0 && nBgn >= 0)
         {
-            nBgn = m_pFat->GetNextPage( nBgn );
+            sal_Int32 nOldBgn = nBgn;
+            nBgn = m_pFat->GetNextPage(nOldBgn);
             if( nBgn >= 0 )
             {
-                m_aPagesCache.push_back( nBgn );
-                nToAdd--;
+                if (nOldBgn != nBgn)
+                {
+                    //very much the normal case
+                    m_aPagesCache.push_back(nBgn);
+                    --nToAdd;
+                }
+                else
+                {
+                    //unclear if this is something we should just immediately
+                    //reject, or allow, for the moment support it but
+                    //optimize that all the pages are the same
+                    SAL_WARN("sot", "fat next page is the same as current page, autofilling " << nToAdd << " pages");
+                    m_aPagesCache.insert(m_aPagesCache.end(), nToAdd, nBgn);
+                    nToAdd = 0;
+                }
             }
         }
     }


More information about the Libreoffice-commits mailing list