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

2023-03-14 Thread Miklos Vajna (via logerrit)
 sot/qa/cppunit/test_sot.cxx |1 -
 1 file changed, 1 deletion(-)

New commits:
commit 34504d2496a32f64952ec434ce1ac30ee2d9fb66
Author: Miklos Vajna 
AuthorDate: Tue Mar 14 12:12:39 2023 +0100
Commit: Miklos Vajna 
CommitDate: Tue Mar 14 15:28:45 2023 +

CppunitTest_sot_test_sot: remove duplicated assert

This was added in commit 29d4ecf32392bc94ab0ba9e73fd79eba65c23fdb
(tdf#115574 sot: fix Excel -> Writer paste, 2018-03-29), where it was
hard to consider 4 bugreports at the same time, so I wrote asserts for
each bugreport. But at the end 1 bugreport is a superset of an other
one, so just moving the 2 comments next to each other having 2 asserts
instead of 3 leads to a simple removal of the duplication.

Change-Id: Iaedccf5ac498dd6842c25b60b507e63332daddf9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148847
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins

diff --git a/sot/qa/cppunit/test_sot.cxx b/sot/qa/cppunit/test_sot.cxx
index 74f0771851d5..7fd1b9a6c18f 100644
--- a/sot/qa/cppunit/test_sot.cxx
+++ b/sot/qa/cppunit/test_sot.cxx
@@ -171,7 +171,6 @@ namespace
 {
 const SotAction_Impl* pFormats = 
sot::GetExchangeDestinationWriterFreeAreaCopy();
 // tdf#52547 prefer BITMAP over HTML
-CPPUNIT_ASSERT(FindFormatIndex(pFormats, SotClipboardFormatId::BITMAP) 
< FindFormatIndex(pFormats, SotClipboardFormatId::HTML));
 // tdf#78801 prefer image over html over text
 CPPUNIT_ASSERT(FindFormatIndex(pFormats, SotClipboardFormatId::BITMAP) 
< FindFormatIndex(pFormats, SotClipboardFormatId::HTML));
 CPPUNIT_ASSERT(FindFormatIndex(pFormats, SotClipboardFormatId::HTML) < 
FindFormatIndex(pFormats, SotClipboardFormatId::STRING));


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

2018-09-18 Thread Libreoffice Gerrit user
 sot/qa/cppunit/test_sot.cxx |4 
 sot/source/base/formats.cxx |5 +
 2 files changed, 9 insertions(+)

New commits:
commit 3c25e7a31bd8b5b40f86208cd141c6108cb736c5
Author: Miklos Vajna 
AuthorDate: Mon Sep 17 21:14:57 2018 +0200
Commit: Miklos Vajna 
CommitDate: Tue Sep 18 09:56:34 2018 +0200

tdf#118784 sot: lower priority of RTF clipboard format on macOS

This was a problem since commit 29d4ecf32392bc94ab0ba9e73fd79eba65c23fdb
(tdf#115574 sot: fix Excel -> Writer paste, 2018-03-29), the root cause
seems to be that (older?) Safari provides RTF clipboard content which
simply doesn't contain the images.

Just to back to the old behavior on macOS for now, hopefully the
problematic RTF producer will go away in the long run.

Change-Id: I5c40b28671978cfbf8593f1cc9775985dffc5030
Reviewed-on: https://gerrit.libreoffice.org/60641
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins

diff --git a/sot/qa/cppunit/test_sot.cxx b/sot/qa/cppunit/test_sot.cxx
index bc6bc95efab1..57c636de0df5 100644
--- a/sot/qa/cppunit/test_sot.cxx
+++ b/sot/qa/cppunit/test_sot.cxx
@@ -176,9 +176,13 @@ namespace
 // tdf#81835 prefer RTF/HTML over GDI Metafile
 CPPUNIT_ASSERT(FindFormatIndex(pFormats, SotClipboardFormatId::RTF) < 
FindFormatIndex(pFormats, SotClipboardFormatId::GDIMETAFILE));
 CPPUNIT_ASSERT(FindFormatIndex(pFormats, SotClipboardFormatId::HTML) < 
FindFormatIndex(pFormats, SotClipboardFormatId::GDIMETAFILE));
+#ifndef MACOSX
 // tdf#115574 prefer RTF over BITMAP (Excel provides a BITMAP we can't
 // read, also Excel paste result used to be an editable table)
 CPPUNIT_ASSERT(FindFormatIndex(pFormats, SotClipboardFormatId::RTF) < 
FindFormatIndex(pFormats, SotClipboardFormatId::BITMAP));
+#else
+CPPUNIT_ASSERT(FindFormatIndex(pFormats, SotClipboardFormatId::BITMAP) 
< FindFormatIndex(pFormats, SotClipboardFormatId::RTF));
+#endif
 }
 
 CPPUNIT_TEST_SUITE_REGISTRATION(SotTest);
diff --git a/sot/source/base/formats.cxx b/sot/source/base/formats.cxx
index 692798b5f19e..243bc911ddaa 100644
--- a/sot/source/base/formats.cxx
+++ b/sot/source/base/formats.cxx
@@ -880,13 +880,18 @@ SotAction_Impl const aEXCHG_DEST_SWDOC_FREE_AREA_Copy[] =
 { SotClipboardFormatId::SD_OLE, EXCHG_OUT_ACTION_INSERT_OLE, 
SotExchangeActionFlags::InsertImageMap | 
SotExchangeActionFlags::InsertTargetUrl, 0 },
 { SotClipboardFormatId::EMBED_SOURCE, EXCHG_OUT_ACTION_INSERT_OLE, 
SotExchangeActionFlags::InsertTargetUrl, 0 },
 { SotClipboardFormatId::EMBEDDED_OBJ, EXCHG_OUT_ACTION_INSERT_OLE, 
SotExchangeActionFlags::InsertTargetUrl, 0 },
+#ifndef MACOSX
 { SotClipboardFormatId::RTF, EXCHG_IN_ACTION_COPY, 
SotExchangeActionFlags::InsertTargetUrl, 0 },
+#endif
 { SotClipboardFormatId::PNG, EXCHG_OUT_ACTION_INSERT_BITMAP, 
SotExchangeActionFlags::InsertImageMap | 
SotExchangeActionFlags::InsertTargetUrl, 0 },
 { SotClipboardFormatId::JPEG, EXCHG_OUT_ACTION_INSERT_BITMAP, 
SotExchangeActionFlags::InsertImageMap | 
SotExchangeActionFlags::InsertTargetUrl, 0 },
 { SotClipboardFormatId::BITMAP, EXCHG_OUT_ACTION_INSERT_BITMAP, 
SotExchangeActionFlags::InsertImageMap | 
SotExchangeActionFlags::InsertTargetUrl, 0 },
 { SotClipboardFormatId::HTML, EXCHG_OUT_ACTION_INSERT_HTML, 
SotExchangeActionFlags::InsertImageMap | 
SotExchangeActionFlags::InsertTargetUrl, 0 },
 { SotClipboardFormatId::HTML_NO_COMMENT, EXCHG_OUT_ACTION_INSERT_HTML, 
SotExchangeActionFlags::InsertImageMap | 
SotExchangeActionFlags::InsertTargetUrl, 0 },
 { SotClipboardFormatId::HTML_SIMPLE, EXCHG_OUT_ACTION_INSERT_HTML, 
SotExchangeActionFlags::InsertImageMap | 
SotExchangeActionFlags::InsertTargetUrl, 0 },
+#ifdef MACOSX
+{ SotClipboardFormatId::RTF, EXCHG_IN_ACTION_COPY, 
SotExchangeActionFlags::InsertTargetUrl, 0 },
+#endif
 { SotClipboardFormatId::NETSCAPE_IMAGE, EXCHG_IN_ACTION_COPY, 
SotExchangeActionFlags::InsertTargetUrl, 0 },
 { SotClipboardFormatId::STRING, EXCHG_OUT_ACTION_INSERT_STRING, 
SotExchangeActionFlags::InsertTargetUrl, 0 },
 { SotClipboardFormatId::NETSCAPE_BOOKMARK, 
EXCHG_OUT_ACTION_INSERT_HYPERLINK, SotExchangeActionFlags::InsertImageMap | 
SotExchangeActionFlags::InsertTargetUrl, 0 },
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-03-31 Thread Andrea Gelmini
 sot/qa/cppunit/test_sot.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit af7b2f4c68dc0f98c3cebc4c5e079db2919516ce
Author: Andrea Gelmini 
Date:   Thu Mar 29 20:41:31 2018 +0200

Fix typo

Change-Id: Ice18bb667b2f8da3321ee61904915079075fd136
Reviewed-on: https://gerrit.libreoffice.org/52196
Tested-by: Jenkins 
Reviewed-by: Jens Carl 

diff --git a/sot/qa/cppunit/test_sot.cxx b/sot/qa/cppunit/test_sot.cxx
index 62fa4b1b5b3b..bc6bc95efab1 100644
--- a/sot/qa/cppunit/test_sot.cxx
+++ b/sot/qa/cppunit/test_sot.cxx
@@ -170,7 +170,7 @@ namespace
 const SotAction_Impl* pFormats = 
sot::GetExchangeDestinationWriterFreeAreaCopy();
 // tdf#52547 prefer BITMAP over HTML
 CPPUNIT_ASSERT(FindFormatIndex(pFormats, SotClipboardFormatId::BITMAP) 
< FindFormatIndex(pFormats, SotClipboardFormatId::HTML));
-// tdf#78801 prefer imager over html over text
+// tdf#78801 prefer image over html over text
 CPPUNIT_ASSERT(FindFormatIndex(pFormats, SotClipboardFormatId::BITMAP) 
< FindFormatIndex(pFormats, SotClipboardFormatId::HTML));
 CPPUNIT_ASSERT(FindFormatIndex(pFormats, SotClipboardFormatId::HTML) < 
FindFormatIndex(pFormats, SotClipboardFormatId::STRING));
 // tdf#81835 prefer RTF/HTML over GDI Metafile
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2018-01-29 Thread Caolán McNamara
 sot/source/sdstor/stgio.cxx|2 +-
 sot/source/sdstor/stgstrms.cxx |4 ++--
 sot/source/sdstor/stgstrms.hxx |2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

New commits:
commit bfc04bc43e378c5d028200da7a49be978ce8d6c4
Author: Caolán McNamara 
Date:   Sun Jan 28 21:02:56 2018 +

ofz#2976 Timeout

Change-Id: Iff085d6bdbbfc7f2c821fdcef8e412aa91152d93
Reviewed-on: https://gerrit.libreoffice.org/48804
Tested-by: Jenkins 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sot/qa/cppunit/data/pass/next-page-1.compound 
b/sot/qa/cppunit/data/fail/next-page-1.compound
similarity index 100%
rename from sot/qa/cppunit/data/pass/next-page-1.compound
rename to sot/qa/cppunit/data/fail/next-page-1.compound
diff --git a/sot/source/sdstor/stgio.cxx b/sot/source/sdstor/stgio.cxx
index fc7c5a9def55..a7e8863c6efd 100644
--- a/sot/source/sdstor/stgio.cxx
+++ b/sot/source/sdstor/stgio.cxx
@@ -279,7 +279,7 @@ FatError Validator::ValidateMasterFATs()
 
 for( sal_Int32 i = 0; i < nCount; i++ )
 {
-if( ( nErr = aFat.Mark(rIo.m_pFAT->GetPage( short(i), false ), 
aFat.GetPageSize(), -3 )) != FatError::Ok )
+if( ( nErr = aFat.Mark(rIo.m_pFAT->GetPage(i, false), 
aFat.GetPageSize(), -3 )) != FatError::Ok)
 return nErr;
 }
 if( rIo.m_aHdr.GetMasters() )
diff --git a/sot/source/sdstor/stgstrms.cxx b/sot/source/sdstor/stgstrms.cxx
index efa03cd14d20..17958544d880 100644
--- a/sot/source/sdstor/stgstrms.cxx
+++ b/sot/source/sdstor/stgstrms.cxx
@@ -588,13 +588,13 @@ bool StgFATStrm::Pos2Page( sal_Int32 nBytePos )
 m_nPage   = nBytePos / m_nPageSize;
 m_nOffset = static_cast( nBytePos % m_nPageSize );
 m_nPos= nBytePos;
-m_nPage   = GetPage( static_cast(m_nPage), false );
+m_nPage   = GetPage(m_nPage, false);
 return m_nPage >= 0;
 }
 
 // Get the page number entry for the given page offset.
 
-sal_Int32 StgFATStrm::GetPage( short nOff, bool bMake, sal_uInt16 
*pnMasterAlloc )
+sal_Int32 StgFATStrm::GetPage(sal_Int32 nOff, bool bMake, sal_uInt16 
*pnMasterAlloc)
 {
 OSL_ENSURE( nOff >= 0, "The offset may not be negative!" );
 if( pnMasterAlloc ) *pnMasterAlloc = 0;
diff --git a/sot/source/sdstor/stgstrms.hxx b/sot/source/sdstor/stgstrms.hxx
index 45c9a71aa8a6..0a6589f204f7 100644
--- a/sot/source/sdstor/stgstrms.hxx
+++ b/sot/source/sdstor/stgstrms.hxx
@@ -103,7 +103,7 @@ class StgFATStrm : public StgStrm { // the master FAT 
stream
 public:
 explicit StgFATStrm(StgIo&, sal_Int32 nFatStrmSize);
 using StgStrm::GetPage;
-sal_Int32 GetPage( short, bool, sal_uInt16 *pnMasterAlloc = nullptr);
+sal_Int32 GetPage(sal_Int32, bool, sal_uInt16 *pnMasterAlloc = nullptr);
 virtual bool SetSize( sal_Int32 ) override;
 };
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-09-22 Thread Caolán McNamara
 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 
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 
Tested-by: Caolán McNamara 

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 ..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;
+}
 }
 }
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-09-18 Thread Caolán McNamara
 sot/qa/cppunit/data/pass/tdf112399-1.compound |binary
 sot/source/sdstor/stgelem.cxx |   12 
 2 files changed, 12 insertions(+)

New commits:
commit fc5513f40acc56410651a147e4b03dc614ea6183
Author: Caolán McNamara 
Date:   Mon Sep 18 21:17:32 2017 +0100

tdf#112399 ignore size of unknown/unused ole2 entries

Change-Id: I9908453c1a11997141f7d6c4e1dccff53984321c
Reviewed-on: https://gerrit.libreoffice.org/42436
Tested-by: Jenkins 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sot/qa/cppunit/data/fail/fdo41642-2.compound 
b/sot/qa/cppunit/data/pass/fdo41642-2.compound
similarity index 100%
rename from sot/qa/cppunit/data/fail/fdo41642-2.compound
rename to sot/qa/cppunit/data/pass/fdo41642-2.compound
diff --git a/sot/qa/cppunit/data/pass/tdf112399-1.compound 
b/sot/qa/cppunit/data/pass/tdf112399-1.compound
new file mode 100644
index ..d3628def0c01
Binary files /dev/null and b/sot/qa/cppunit/data/pass/tdf112399-1.compound 
differ
diff --git a/sot/source/sdstor/stgelem.cxx b/sot/source/sdstor/stgelem.cxx
index 4e18d0e1b4d0..a178ff45f603 100644
--- a/sot/source/sdstor/stgelem.cxx
+++ b/sot/source/sdstor/stgelem.cxx
@@ -424,6 +424,18 @@ bool StgEntry::Load(const void* pFrom, sal_uInt32 
nBufSize, sal_uInt64 nUnderlyi
 //bad pageid
 return false;
 }
+if (m_cType == STG_EMPTY)
+{
+/*
+ tdf#112399 opens fine in MSOffice 2013 despite a massive m_nSize 
field
+
+ Free (unused) directory entries are marked with Object Type 0x0
+ (unknown or unallocated). The entire directory entry must consist 
of
+ all zeroes except for the child, right sibling, and left sibling
+ pointers, which must be initialized to NOSTREAM (0x).
+*/
+m_nSize = 0;
+}
 if (m_nSize < 0)
 {
 // the size makes no sense for the substorage
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-03-14 Thread Caolán McNamara
 sot/qa/cppunit/data/pass/loop-1.compound |binary
 sot/source/sdstor/stgdir.cxx |   18 ++
 2 files changed, 6 insertions(+), 12 deletions(-)

New commits:
commit 9e83222bb1bf18ebcfa354f958606677a63ab1d9
Author: Caolán McNamara 
Date:   Tue Mar 14 16:11:40 2017 +

check full chain upwards

Change-Id: I3a620824b987bf78eaabffa913a3a62a842ba0d9
Reviewed-on: https://gerrit.libreoffice.org/35193
Tested-by: Jenkins 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sot/qa/cppunit/data/pass/loop-1.compound 
b/sot/qa/cppunit/data/pass/loop-1.compound
new file mode 100644
index 000..eddb916
Binary files /dev/null and b/sot/qa/cppunit/data/pass/loop-1.compound differ
diff --git a/sot/source/sdstor/stgdir.cxx b/sot/source/sdstor/stgdir.cxx
index a4c682d..7d49622 100644
--- a/sot/source/sdstor/stgdir.cxx
+++ b/sot/source/sdstor/stgdir.cxx
@@ -800,23 +800,17 @@ void StgDirStrm::SetupEntry( sal_Int32 n, StgDirEntry* 
pUpper )
 
 if( nLeaf != 0 && nLeft != 0 && nRight != 0 )
 {
-//fdo#41642 Do we need to check full chain upwards for loops ?
-if (pUpper)
+//fdo#41642
+StgDirEntry *pUp = pUpper;
+while (pUp)
 {
-if (pUpper->m_aEntry.GetLeaf(STG_CHILD) == nLeaf)
+if (pUp->m_aEntry.GetLeaf(STG_CHILD) == nLeaf)
 {
-OSL_FAIL("Leaf node of upper StgDirEntry is same as 
current StgDirEntry's leaf node. Circular entry chain, discarding link");
-delete pCur;
-return;
-}
-
-StgDirEntry *pUpperUpper = pUpper->m_pUp;
-if (pUpperUpper && pUpperUpper->m_aEntry.GetLeaf(STG_CHILD) == 
nLeaf)
-{
-OSL_FAIL("Leaf node of upper-upper StgDirEntry is same as 
current StgDirEntry's leaf node. Circular entry chain, discarding link");
+SAL_WARN("sot", "Leaf node of upper StgDirEntry is same as 
current StgDirEntry's leaf node. Circular entry chain, discarding link");
 delete pCur;
 return;
 }
+pUp = pUp->m_pUp;
 }
 
 if( StgAvlNode::Insert
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2015-07-22 Thread Caolán McNamara
 dev/null |binary
 sot/qa/cppunit/data/fail/fdo41642-2.compound |binary
 sot/source/sdstor/stgdir.cxx |   11 ---
 sot/source/sdstor/stgdir.hxx |3 ++-
 sot/source/sdstor/stgelem.cxx|   25 -
 sot/source/sdstor/stgelem.hxx|2 +-
 sw/qa/core/data/ww8/fail/hang-2.doc  |binary
 sw/qa/core/data/ww8/pass/tdf57532-1.doc  |binary
 8 files changed, 31 insertions(+), 10 deletions(-)

New commits:
commit 786573068dce1f71c53057f98b5822c401c9f3ff
Author: Caolán McNamara caol...@redhat.com
Date:   Wed Jul 22 09:24:53 2015 +0100

limit storage entry max size to size of underlying stream

Change-Id: Ie3772338009c07fea40b637621b1170863830e14
Reviewed-on: https://gerrit.libreoffice.org/17296
Reviewed-by: Michael Meeks michael.me...@collabora.com
Reviewed-by: Caolán McNamara caol...@redhat.com
Tested-by: Caolán McNamara caol...@redhat.com

diff --git a/sot/qa/cppunit/data/pass/fdo41642-2.compound 
b/sot/qa/cppunit/data/fail/fdo41642-2.compound
similarity index 100%
rename from sot/qa/cppunit/data/pass/fdo41642-2.compound
rename to sot/qa/cppunit/data/fail/fdo41642-2.compound
diff --git a/sot/source/sdstor/stgdir.cxx b/sot/source/sdstor/stgdir.cxx
index 6ee4a61..e2c8bf7 100644
--- a/sot/source/sdstor/stgdir.cxx
+++ b/sot/source/sdstor/stgdir.cxx
@@ -48,9 +48,9 @@
 // Problem der Implementation: Keine Hierarchischen commits. Daher nur
 // insgesamt transaktionsorientert oder direkt.
 
-StgDirEntry::StgDirEntry( const void* pBuffer, sal_uInt32 nBufferLen, bool * 
pbOk ) : StgAvlNode()
+StgDirEntry::StgDirEntry( const void* pBuffer, sal_uInt32 nBufferLen, 
sal_uInt64 nUnderlyingStreamSize, bool * pbOk ) : StgAvlNode()
 {
-*pbOk = aEntry.Load( pBuffer, nBufferLen );
+*pbOk = aEntry.Load( pBuffer, nBufferLen, nUnderlyingStreamSize );
 
 InitMembers();
 }
@@ -819,8 +819,13 @@ void StgDirStrm::SetupEntry( sal_Int32 n, StgDirEntry* 
pUpper )
 void* p = ( n == STG_FREE ) ? NULL : GetEntry( n );
 if( p )
 {
+SvStream *pUnderlyingStream = rIo.GetStrm();
+sal_uInt64 nCur = pUnderlyingStream-Tell();
+sal_uInt64 nUnderlyingStreamSize = 
pUnderlyingStream-Seek(STREAM_SEEK_TO_END);
+pUnderlyingStream-Seek(nCur);
+
 bool bOk(false);
-StgDirEntry* pCur = new StgDirEntry( p, STGENTRY_SIZE, bOk );
+StgDirEntry* pCur = new StgDirEntry( p, STGENTRY_SIZE, 
nUnderlyingStreamSize, bOk );
 
 if( !bOk )
 {
diff --git a/sot/source/sdstor/stgdir.hxx b/sot/source/sdstor/stgdir.hxx
index c0924f1..55be53d 100644
--- a/sot/source/sdstor/stgdir.hxx
+++ b/sot/source/sdstor/stgdir.hxx
@@ -62,7 +62,8 @@ public:
 bool bDirect;   // true: direct mode
 bool bZombie;   // true: Removed From StgIo
 bool bInvalid;  // true: invalid entry
-StgDirEntry( const void* pBuffer, sal_uInt32 nBufferLen, bool * pbOk );
+StgDirEntry(const void* pBuffer, sal_uInt32 nBufferLen,
+sal_uInt64 nUnderlyingStreamSize, bool * pbOk);
 StgDirEntry( const StgEntry );
 virtual ~StgDirEntry();
 
diff --git a/sot/source/sdstor/stgelem.cxx b/sot/source/sdstor/stgelem.cxx
index 8e2f9bd..bb85e9f 100644
--- a/sot/source/sdstor/stgelem.cxx
+++ b/sot/source/sdstor/stgelem.cxx
@@ -361,7 +361,7 @@ sal_Int32 StgEntry::Compare( const StgEntry r ) const
 // These load/store operations are a bit more complicated,
 // since they have to copy their contents into a packed structure.
 
-bool StgEntry::Load( const void* pFrom, sal_uInt32 nBufSize )
+bool StgEntry::Load(const void* pFrom, sal_uInt32 nBufSize, sal_uInt64 
nUnderlyingStreamSize)
 {
 if ( nBufSize  128 )
 return false;
@@ -392,11 +392,26 @@ bool StgEntry::Load( const void* pFrom, sal_uInt32 
nBufSize )
 if (n  nMaxLegalStr)
 return false;
 
-if ((cType != STG_STORAGE)  ((nSize  0) || (nPage1  0  
!isKnownSpecial(nPage1
+if (cType != STG_STORAGE)
 {
-// the size makes no sense for the substorage
-// TODO/LATER: actually the size should be an unsigned value, but in 
this case it would mean a stream of more than 2Gb
-return false;
+if (nPage1  0  !isKnownSpecial(nPage1))
+{
+//bad pageid
+return false;
+}
+if (nSize  0)
+{
+// the size makes no sense for the substorage
+// TODO/LATER: actually the size should be an unsigned value, but
+// in this case it would mean a stream of more than 2Gb
+return false;
+}
+if (static_castsal_uInt64(nSize)  nUnderlyingStreamSize)
+{
+// surely an entry cannot be larger than the underlying file
+return false;
+}
+
 }
 
 aName = OUString(nName , n);
diff --git a/sot/source/sdstor/stgelem.hxx 

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

2014-02-25 Thread Alexander Wilms
 sot/qa/complex/olesimplestorage/OLESimpleStorageUnitTest.java |2 
 sot/source/base/factory.cxx   |2 
 sot/source/base/object.cxx|6 +-
 sot/source/sdstor/stg.cxx |   10 ++--
 sot/source/sdstor/stgavl.cxx  |2 
 sot/source/sdstor/stgcache.cxx|4 -
 sot/source/sdstor/stgdir.cxx  |4 -
 sot/source/sdstor/stgelem.cxx |6 +-
 sot/source/sdstor/stgio.cxx   |2 
 sot/source/sdstor/stgole.cxx  |6 +-
 sot/source/sdstor/stgstrms.cxx|   14 ++---
 sot/source/unoolestorage/xolesimplestorage.hxx|   24 +-
 12 files changed, 41 insertions(+), 41 deletions(-)

New commits:
commit 614e1a6cf8839344755ea8d5227561f75772aa2a
Author: Alexander Wilms f.alexander.wi...@gmail.com
Date:   Tue Feb 25 20:40:23 2014 +0100

Remove visual noise from sot

Change-Id: I731691d4cac8567938407a514a25e13b2baa7958
Reviewed-on: https://gerrit.libreoffice.org/8314
Reviewed-by: Caolán McNamara caol...@redhat.com
Tested-by: Caolán McNamara caol...@redhat.com

diff --git a/sot/qa/complex/olesimplestorage/OLESimpleStorageUnitTest.java 
b/sot/qa/complex/olesimplestorage/OLESimpleStorageUnitTest.java
index 13f6515..58ba596 100644
--- a/sot/qa/complex/olesimplestorage/OLESimpleStorageUnitTest.java
+++ b/sot/qa/complex/olesimplestorage/OLESimpleStorageUnitTest.java
@@ -40,7 +40,7 @@ public class OLESimpleStorageUnitTest /* extends 
ComplexTestCase */
 //return new String[] {
 //ExecuteTest01};
 //}
-//
+
 //public String getTestObjectName() {
 //return OLESimpleStorageUnitTest;
 //}
diff --git a/sot/source/base/factory.cxx b/sot/source/base/factory.cxx
index 0cd94cd..1b28f70 100644
--- a/sot/source/base/factory.cxx
+++ b/sot/source/base/factory.cxx
@@ -102,7 +102,7 @@ SotFactory::SotFactory( const SvGlobalName  rName,
 }
 
 
-//=
+
 SotFactory::~SotFactory()
 {
 delete [] pSuperClasses;
diff --git a/sot/source/base/object.cxx b/sot/source/base/object.cxx
index cd14c74..0730ad5 100644
--- a/sot/source/base/object.cxx
+++ b/sot/source/base/object.cxx
@@ -72,7 +72,7 @@ IUnknown * SotObject::GetInterface( const SvGlobalName  )
 return NULL;
 }
 
-//=
+
 void SotObject::OwnerLock
 (
 bool bLock  /* true, lock. false, unlock. */
@@ -98,7 +98,7 @@ void SotObject::OwnerLock
 }
 }
 
-//=
+
 bool SotObject::DoClose()
 {
 bool bRet = false;
@@ -112,7 +112,7 @@ bool SotObject::DoClose()
 return bRet;
 }
 
-//=
+
 bool SotObject::Close()
 {
 return true;
diff --git a/sot/source/sdstor/stg.cxx b/sot/source/sdstor/stg.cxx
index 684d36f..6ffb6ba 100644
--- a/sot/source/sdstor/stg.cxx
+++ b/sot/source/sdstor/stg.cxx
@@ -41,7 +41,7 @@ static long nTmpCount = 0;
 
 #define INTERNAL_MODE ( STREAM_READ | STREAM_TRUNC )
 
-/ class StorageBase //
+/ class StorageBase
 
 TYPEINIT0( StorageBase );
 TYPEINIT1( BaseStorageStream, StorageBase );
@@ -159,7 +159,7 @@ bool OLEStorageBase::ValidateMode_Impl( StreamMode m, 
StgDirEntry* p ) const
 }
 
 
- class StorageStream /
+ class StorageStream
 
 TYPEINIT1( StorageStream, BaseStorageStream );
 
@@ -319,7 +319,7 @@ bool StorageStream::ValidateMode( StreamMode nMode ) const
 return bRet;
 }
 
-/ class SvStorageInfo //
+/ class SvStorageInfo
 
 SvStorageInfo::SvStorageInfo( const StgDirEntry rE )
 {
@@ -329,7 +329,7 @@ SvStorageInfo::SvStorageInfo( const StgDirEntry rE )
 nSize= bStorage ? 0 : rE.aEntry.GetSize();
 }
 
-/// class Storage 
+/// class Storage
 
 bool Storage::IsStorageFile( const OUString  rFileName )
 {
@@ -927,7 +927,7 @@ bool Storage::Revert()
 return true;
 }
 
-/ OLE Support 
+/ OLE Support
 
 // Set the storage type
 
diff --git a/sot/source/sdstor/stgavl.cxx b/sot/source/sdstor/stgavl.cxx
index 807f023..722fb25 100644
--- a/sot/source/sdstor/stgavl.cxx
+++ b/sot/source/sdstor/stgavl.cxx
@@ -380,7 +380,7 @@ bool StgAvlNode::Move( StgAvlNode** pRoot1, StgAvlNode** 
pRoot2, StgAvlNode* pMo
 return false;
 }
 
-// class