summaryrefslogtreecommitdiff
path: root/sot
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2017-09-22 12:51:39 +0100
committerCaolán McNamara <caolanm@redhat.com>2017-09-22 18:00:03 +0200
commite0c9088315981e9ee2743ce03ffb6c3b20980c8b (patch)
tree2d64e12e771ca36684972a74b4083d934688ae09 /sot
parent8b690f22c9deb6d1171328dfe5607d4c673dc993 (diff)
ofz#2976 timeout in olefuzzer
Change-Id: Ic64e5eaa6b524403e46f9907499b0b853792a971 Reviewed-on: https://gerrit.libreoffice.org/42640 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sot')
-rw-r--r--sot/qa/cppunit/data/pass/next-page-1.compoundbin0 -> 763 bytes
-rw-r--r--sot/source/sdstor/stgstrms.cxx22
2 files changed, 18 insertions, 4 deletions
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
--- /dev/null
+++ b/sot/qa/cppunit/data/pass/next-page-1.compound
Binary files 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;
+ }
}
}
}