Date: prev next · Thread: first prev next last
2018 Archives by date, by thread · List index


Hello,

Trying to investigate about tdf#121074, I've retrieved a bt + some console logs which include this kind of line:

warn:legacy.osl:3913:3913:sc/source/filter/oox/worksheethelper.cxx:533: WorksheetGlobals::getDrawPageSize - called too early, size invalid

->

    531 const awt::Size& WorksheetGlobals::getDrawPageSize() const
    532 {
    533     OSL_ENSURE( (maDrawPageSize.Width > 0) && (maDrawPageSize.Height > 0), "WorksheetGlobals::getDrawPageSize - called too early, size invalid" );
    534     return maDrawPageSize;
    535 }


To understand the pb, I put some asserts (since I use enable-dbgutil) in setWidth and setHeight methods:

diff --git a/include/tools/gen.hxx b/include/tools/gen.hxx
index 5d6ff5ea66b8..2ce006bde31e 100644
--- a/include/tools/gen.hxx
+++ b/include/tools/gen.hxx
@@ -21,6 +21,7 @@

 #include <tools/toolsdllapi.h>

+#include <cassert>
 #include <limits.h>
 #include <algorithm>
 #include <ostream>
@@ -194,8 +195,16 @@ public:

     long            getWidth() const { return Width(); }
     long            getHeight() const { return Height(); }
-    void            setWidth(long nWidth)  { nA = nWidth; }
-    void            setHeight(long nHeight)  { nB = nHeight; }
+    void            setWidth(long nWidth)
+    {
+        assert((nWidth >= 0 || nWidth == -1) && "Wrong value for width");
+        nA = nWidth;
+    }
+    void            setHeight(long nHeight)
+    {
+        assert((nHeight >= 0 || nHeight == -1) && "Wrong value for height");
+        nB = nHeight;
+    }

     Pair const &    toPair() const { return *this; }
     Pair &          toPair() { return *this; }

Result was quite long to obtain since it supposes to rebuild big chunks of LO but finally got this:

Testing file:///home/julien/lo/libreoffice/vcl/qa/cppunit/graphicfilter/data/svm/fail/mapmode-1.svm: cppunittester: /home/julien/lo/libreoffice/include/tools/gen.hxx:200: void Size::setWidth(long int): Assertion `(nWidth >= 0 || nWidth == -1) && "Wrong value for width"' failed

(gdb) frame 5
#5  0x00007ffff0d75c30 in SVMConverter::ImplConvertFromSVM1 (rIStm=..., rMtf=...) at /home/julien/lo/libreoffice/vcl/source/gdi/svmconverter.cxx:264 264        aPrefSz.setWidth( nTmp32 );                       // PrefSize.Width()
(gdb) p nTmp32
$1 = -16682258

Looking at git history from vcl/qa/cppunit/graphicfilter/data/svm/fail/mapmode-1.svm, I got d776eeab752fd313226a7570c3ed4d8e964b4406

"ofz#937 sanity check claimed record length"

1) Do you think these asserts are ok?

2) If yes, any thoughts how to fix this specific test with the svm (hoping there won't be more but I'm a bit pessimistic about this)?

Should we add some tests on nTmp32 before calling setWidth and setHeight in vcl/source/gdi/svmconverter.cxx#264 ?

Julien

Testing file:///home/julien/lo/libreoffice/vcl/qa/cppunit/graphicfilter/data/svm/fail/mapmode-1.svm:
cppunittester: /home/julien/lo/libreoffice/include/tools/gen.hxx:200: void Size::setWidth(long 
int): Assertion `(nWidth >= 0 || nWidth == -1) && "Wrong value for width"' failed.

Program received signal SIGABRT, Aborted.
__GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
51      ../sysdeps/unix/sysv/linux/raise.c: Aucun fichier ou dossier de ce type.
(gdb) bt
#0  0x00007ffff78faf3b in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
#1  0x00007ffff78fc2f1 in __GI_abort () at abort.c:79
#2  0x00007ffff78f3a8a in __assert_fail_base (fmt=0x7ffff7a47ec8 "%s%s%s:%u: %s%sAssertion `%s' 
failed.\n%n", assertion=assertion@entry=0x7ffff13ae120 "(nWidth >= 0 || nWidth == -1) && \"Wrong 
value for width\"", file=file@entry=0x7ffff13ae0e8 
"/home/julien/lo/libreoffice/include/tools/gen.hxx", line=line@entry=200, 
function=function@entry=0x7ffff13b11f0 <Size::setWidth(long)::__PRETTY_FUNCTION__> "void 
Size::setWidth(long int)") at assert.c:92
#3  0x00007ffff78f3b02 in __GI___assert_fail (assertion=0x7ffff13ae120 "(nWidth >= 0 || nWidth == 
-1) && \"Wrong value for width\"", file=0x7ffff13ae0e8 
"/home/julien/lo/libreoffice/include/tools/gen.hxx", line=200, function=0x7ffff13b11f0 
<Size::setWidth(long)::__PRETTY_FUNCTION__> "void Size::setWidth(long int)") at assert.c:101
#4  0x00007ffff097958d in Size::setWidth(long) (this=0x7fffffff05f0, nWidth=-16682258) at 
/home/julien/lo/libreoffice/include/tools/gen.hxx:200
#5  0x00007ffff0d75c30 in SVMConverter::ImplConvertFromSVM1(SvStream&, GDIMetaFile&) (rIStm=..., 
rMtf=...) at /home/julien/lo/libreoffice/vcl/source/gdi/svmconverter.cxx:264
#6  0x00007ffff0d75aa0 in SVMConverter::SVMConverter(SvStream&, GDIMetaFile&) (this=0x7fffffff0a08, 
rStm=..., rMtf=...)
    at /home/julien/lo/libreoffice/vcl/source/gdi/svmconverter.cxx:229
#7  0x00007ffff0d9b949 in ReadGDIMetaFile(SvStream&, GDIMetaFile&, ImplMetaReadData*) (rIStm=..., 
rGDIMetaFile=..., pData=0x0)
    at /home/julien/lo/libreoffice/vcl/source/gdi/gdimtf.cxx:2690
#8  0x00007ffff0dc2cb8 in ReadImpGraphic(SvStream&, ImpGraphic&) (rIStm=..., rImpGraphic=...) at 
/home/julien/lo/libreoffice/vcl/source/gdi/impgraph.cxx:1831
#9  0x00007ffff0db29da in ReadGraphic(SvStream&, Graphic&) (rIStream=..., rGraphic=...) at 
/home/julien/lo/libreoffice/vcl/source/gdi/graph.cxx:547
#10 0x00007ffff108c5d2 in GraphicFilter::ImportGraphic(Graphic&, rtl::OUString const&, SvStream&, 
unsigned short, unsigned short*, GraphicFilterImportFlags, 
com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>*, WmfExternal const*) 
(this=0x5555562f8860, rGraphic=..., 
rPath="file:///home/julien/lo/libreoffice/vcl/qa/cppunit/graphicfilter/data/svm/fail/mapmode-1.svm",
 rIStream=..., nFormat=16, pDeterminedFormat=0x0, nImportFlags=GraphicFilterImportFlags::NONE, 
pFilterData=0x0, pExtHeader=0x0)
    at /home/julien/lo/libreoffice/vcl/source/filter/graphicfilter.cxx:1923
#11 0x00007ffff1089605 in GraphicFilter::ImportGraphic(Graphic&, rtl::OUString const&, SvStream&, 
unsigned short, unsigned short*, GraphicFilterImportFlags, WmfExternal const*) 
(this=0x5555562f8860, rGraphic=..., 
rPath="file:///home/julien/lo/libreoffice/vcl/qa/cppunit/graphicfilter/data/svm/fail/mapmode-1.svm",
 rIStream=..., nFormat=65535, pDeterminedFormat=0x0, nImportFlags=GraphicFilterImportFlags::NONE, 
pExtHeader=0x0) at /home/julien/lo/libreoffice/vcl/source/filter/graphicfilter.cxx:1281
#12 0x00007ffff0291b3b in VclFiltersTest::load(rtl::OUString const&, rtl::OUString const&, 
rtl::OUString const&, SfxFilterFlags, SotClipboardFormatId, unsigned int) (this=0x5555562f8750, 
rURL="file:///home/julien/lo/libreoffice/vcl/qa/cppunit/graphicfilter/data/svm/fail/mapmode-1.svm")
    at /home/julien/lo/libreoffice/vcl/qa/cppunit/graphicfilter/filters-test.cxx:62
#13 0x00007fffeb19e722 in test::FiltersTest::recursiveScan(test::filterStatus, rtl::OUString 
const&, rtl::OUString const&, rtl::OUString const&, SfxFilterFlags, SotClipboardFormatId, unsigned 
int, bool) (this=0x5555562f8750, nExpected=test::fail, rFilter="", 
rURL="file:///home/julien/lo/libreoffice//vcl/qa/cppunit/graphicfilter/data/svm/fail", 
rUserData="", nFilterFlags=SfxFilterFlags::IMPORT, nClipboardID=SotClipboardFormatId::NONE, 
nFilterVersion=0, bExport=false)
    at /home/julien/lo/libreoffice/unotest/source/cpp/filters-test.cxx:130
#14 0x00007fffeb19efa6 in test::FiltersTest::testDir(rtl::OUString const&, rtl::OUString const&, 
rtl::OUString const&, SfxFilterFlags, SotClipboardFormatId, unsigned int, bool) 
(this=0x5555562f8750, rFilter="", 
rURL="file:///home/julien/lo/libreoffice//vcl/qa/cppunit/graphicfilter/data/svm/", rUserData="", 
nFilterFlags=SfxFilterFlags::IMPORT, nClipboardID=SotClipboardFormatId::NONE, nFilterVersion=0, 
bExport=false) at /home/julien/lo/libreoffice/unotest/source/cpp/filters-test.cxx:158
#15 0x00007ffff02932e7 in VclFiltersTest::testCVEs() (this=0x5555562f8750) at 
/home/julien/lo/libreoffice/vcl/qa/cppunit/graphicfilter/filters-test.cxx:173
#16 0x00007ffff02983a6 in std::__invoke_impl<void, void (VclFiltersTest::*&)(), 
VclFiltersTest*&>(std::__invoke_memfun_deref, void (VclFiltersTest::*&)(), VclFiltersTest*&) 
(__f=@0x5555562f9b40: (void (VclFiltersTest::*)(VclFiltersTest * const)) 0x7ffff0292d30 
<VclFiltersTest::testCVEs()>, __t=@0x5555562f9b50: 0x5555562f8750)
    at /usr/include/c++/8/bits/invoke.h:73
#17 0x00007ffff0298229 in std::__invoke<void (VclFiltersTest::*&)(), VclFiltersTest*&>(void 
(VclFiltersTest::*&)(), VclFiltersTest*&) (__fn=@0x5555562f9b40: (void 
(VclFiltersTest::*)(VclFiltersTest * const)) 0x7ffff0292d30 <VclFiltersTest::testCVEs()>, 
__args#0=@0x5555562f9b50: 0x5555562f8750) at /usr/include/c++/8/bits/invoke.h:95
#18 0x00007ffff0297db3 in std::_Bind<void (VclFiltersTest::*(VclFiltersTest*))()>::__call<void, , 
0ul>(std::tuple<>&&, std::_Index_tuple<0ul>) (this=0x5555562f9b40, __args=...) at 
/usr/include/c++/8/functional:400
#19 0x00007ffff0297631 in std::_Bind<void (VclFiltersTest::*(VclFiltersTest*))()>::operator()<, 
void>() (this=0x5555562f9b40) at /usr/include/c++/8/functional:484
#20 0x00007ffff0296e5d in std::_Function_handler<void (), std::_Bind<void 
(VclFiltersTest::*(VclFiltersTest*))()> >::_M_invoke(std::_Any_data const&) (__functor=...)
    at /usr/include/c++/8/bits/std_function.h:297
---Type <return> to continue, or q <return> to quit---q
Quit
(gdb) frame 5
#5  0x00007ffff0d75c30 in SVMConverter::ImplConvertFromSVM1 (rIStm=..., rMtf=...) at 
/home/julien/lo/libreoffice/vcl/source/gdi/svmconverter.cxx:264
264         aPrefSz.setWidth( nTmp32 );                       // PrefSize.Width()
(gdb) p nTmp32
$1 = -16682258
(gdb) list
259         rIStm.ReadInt16( nSize );                                 // Size
260         sal_Int16 nVersion(0);
261         rIStm.ReadInt16( nVersion );                              // Version
262         sal_Int32 nTmp32(0);
263         rIStm.ReadInt32( nTmp32 );
264         aPrefSz.setWidth( nTmp32 );                       // PrefSize.Width()
265         rIStm.ReadInt32( nTmp32 );
266         aPrefSz.setHeight( nTmp32 );                      // PrefSize.Height()
267     
268         // check header-magic and version
(gdb) p nVersion
$2 = 200
(gdb) p nSize
$3 = 2884


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.