[Libreoffice] Wrong cast to css.table.BorderLine2

Stephan Bergmann sbergman at redhat.com
Mon Jan 23 12:41:39 PST 2012


Valgrind'ing sc_unoapi unearthed

> Creating: sc.ScAutoFormatFieldObj
> LOG> Log started 23.00.2012 - 21:27:56
> LOG> create Object ...
> Environment created
> LOG> Log started 23.00.2012 - 21:28:21
> checking: [sc.ScAutoFormatFieldObj::com::sun::star::beans::XPropertySet] is iface: [com.sun.star.beans.XPropertySet] testcode: [ifc.beans._XPropertySet]
> LOG> Execute: getPropertySetInfo()
> Method getPropertySetInfo() finished with state OK
> LOG> Getting:
> LOG> Setting to :New
> LOG> Getting: 16777215
> LOG> Setting to :16777220
> LOG> Getting: 2
> LOG> Setting to :3
> LOG> Getting: 76
> LOG> Setting to :77
> LOG> Getting: 0
> LOG> Setting to :5
> LOG> Getting: Any[Type[void], null]
> LOG> Property 'HoriJustifyMethod' is void but MAYBEVOID isn't set
> LOG> Couldn't change Property 'HoriJustifyMethod'
> LOG> Getting:
> LOG> Setting to :New
> LOG> Getting: 100.0
> LOG> Setting to :116.7
> LOG> Getting: 100.0
> LOG> Setting to :116.7
> LOG> Getting: 10.0
> LOG> Setting to :26.7
> LOG> Getting: 100.0
> LOG> Setting to :116.7
> LOG> Getting: com.sun.star.table.TableBorder at 3bc0f2e5
> LOG> Setting to :com.sun.star.table.TableBorder at f5e0873
> ==5465== Thread 8:
> ==5465== Conditional jump or move depends on uninitialised value(s)
> ==5465==    at 0x217AA402: editeng::SvxBorderLine::getWidthImpl(editeng::SvxBorderStyle) (/editeng/source/items/borderline.cxx:128)
> ==5465==    by 0x217AACD7: editeng::SvxBorderLine::SetStyle(editeng::SvxBorderStyle) (/editeng/source/items/borderline.cxx:331)
> ==5465==    by 0x20560DB5: ScHelperFunctions::GetBorderLine(editeng::SvxBorderLine&, com::sun::star::table::BorderLine const&) (/sc/source/ui/unoobj/cellsuno.cxx:956)
> ==5465==    by 0x20560F38: ScHelperFunctions::FillBoxItems(SvxBoxItem&, SvxBoxInfoItem&, com::sun::star::table::TableBorder const&) (/sc/source/ui/unoobj/cellsuno.cxx:973)
> ==5465==    by 0x20552EEB: ScAutoFormatFieldObj::setPropertyValue(rtl::OUString const&, com::sun::star::uno::Any const&) (/sc/source/ui/unoobj/afmtuno.cxx:781)
> ==5465==    by 0x15CEF7F4: callVirtualMethod(void*, unsigned int, void*, _typelib_TypeDescriptionReference*, bool, unsigned long*, unsigned int, unsigned long*, unsigned int, double*, unsigned int) (/bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx:155)
> ==5465==    by 0x15CF0334: cpp_call(bridges::cpp_uno::shared::UnoInterfaceProxy*, bridges::cpp_uno::shared::VtableSlot, _typelib_TypeDescriptionReference*, int, _typelib_MethodParameter*, void*, void**, _uno_Any**) (/bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx:392)
> ==5465==    by 0x15CF0E19: bridges::cpp_uno::shared::unoInterfaceProxyDispatch(_uno_Interface*, _typelib_TypeDescription const*, void*, void**, _uno_Any**) (/bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx:586)
> ==5465==    by 0x1B36EF29: binaryurp::IncomingRequest::execute_throw(binaryurp::BinaryAny*, std::__debug::vector<binaryurp::BinaryAny, std::allocator<binaryurp::BinaryAny> >*) const (/binaryurp/source/incomingrequest.cxx:263)
> ==5465==    by 0x1B36DE7E: binaryurp::IncomingRequest::execute() const (/binaryurp/source/incomingrequest.cxx:89)
> ==5465==    by 0x1B388B23: request (/binaryurp/source/reader.cxx:107)
> ==5465==    by 0x5BCC9AD: cppu_threadpool::JobQueue::enter(long, unsigned char) (/cppu/source/threadpool/jobqueue.cxx:121)
> ==5465==    by 0x5BCFF9F: cppu_threadpool::ORequestThread::run() (/cppu/source/threadpool/thread.cxx:222)
> ==5465==    by 0x5BCF73F: cppu_requestThreadWorker (/cppu/source/threadpool/thread.cxx:57)
> ==5465==    by 0x4C2D242: osl_thread_start_Impl (/sal/osl/unx/thread.c:292)
> ==5465==    by 0x37E6C07D8F: start_thread (/usr/src/debug/glibc-2.14-394-g8f3b1ff/nptl/pthread_create.c:309)
> ==5465==    by 0x37E68EF48C: clone (/usr/src/debug////////glibc-2.14-394-g8f3b1ff/misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:115)
> ==5465==  Uninitialised value was created by a stack allocation
> ==5465==    at 0x20552A5B: ScAutoFormatFieldObj::setPropertyValue(rtl::OUString const&, com::sun::star::uno::Any const&) (/sc/source/ui/unoobj/afmtuno.cxx:709)

where borderline.cxx:128
   >     const table::BorderLine2& rBorder2 = static_cast< const 
table::BorderLine2& >( rStruct );

erroneously treats a BorderLine contained in a TableBorder (created at 
afmtuno.cxx:776) as a derived BorderLine2.  That cast seemingly got in with

> commit 89d3e8a8424ce44404a554812e5136452bb8cb60
> Author: Cédric Bosdonnat <cedricbosdo at openoffice.org>
> Date:   Fri Dec 24 10:00:15 2010 +0100
>
>     Switching the order of the SetLinesWidth arguments

Stephan


More information about the LibreOffice mailing list