[Libreoffice] LoadComponentFromUrl misuse lead to crash

Laurent Godard lgodard.libre at laposte.net
Mon Nov 28 09:22:05 PST 2011


Hi

here is a summary of the bug i encounter, present in all LibO versions
(master, 344, 322), but safe in OOo321

inside a macro, i launch a stardesktop.loadComponentFromUrl(firstArg, ...).

if firstArg is an URL, starting with file://, no problem
if firstArg is a path, /the/path/to/my/file, LibO crashes

yes, firstArg has to be an URL, it is specified. But LibO should throw
an IllegalArgumentException as OOo does. Never good that LibO crashes

when i say it crashes, it starts loading. but then enters a loop when
progress bar ends; using gdb, i have a lot of the same cycle calls
(given at the of the mail)

Examining the code, i see no URL check (but may have missed something,
high probability)

http://opengrok.libreoffice.org/xref/core/framework/source/services/desktop.cxx#657

http://opengrok.libreoffice.org/xref/core/framework/source/loadenv/loadenv.cxx#164
http://opengrok.libreoffice.org/xref/core/framework/source/loadenv/loadenv.cxx#180

http://opengrok.libreoffice.org/xref/core/framework/source/loadenv/loadenv.cxx#239
http://opengrok.libreoffice.org/xref/core/framework/source/loadenv/loadenv.cxx#281

I propose to add a check of validity of sURl somewhere and throw
illegalArgument
The most easy i see would be in
http://opengrok.libreoffice.org/xref/core/framework/source/services/desktop.cxx#657

any other better place in your opinion ?
may be in
http://opengrok.libreoffice.org/xref/core/framework/source/loadenv/loadenv.cxx#classifyContent
???

do we have any tool that can check if an URL is valid ? (taking various
protocols into account like in
http://opengrok.libreoffice.org/xref/core/framework/source/loadenv/loadenv.cxx#631

any guidelines welcome so that i can propose a patch

Laurent

'----

gdb bt

#0  0xb7b52af4 in typelib_static_type_getByTypeClass () from
/home/lgodard/projets/libreoffice/build/git/master/libo/solver/unxlngi6.pro/installation/opt/program/../ure-link/lib/libuno_cppu.so.3
#1  0xb7afe90b in
cppu::OWeakObject::queryInterface(com::sun::star::uno::Type const&) ()
   from
/home/lgodard/projets/libreoffice/build/git/master/libo/solver/unxlngi6.pro/installation/opt/program/../ure-link/lib/libuno_cppuhelpergcc3.so.3
#2  0xb7af7975 in cppu::WeakImplHelper_query(com::sun::star::uno::Type
const&, cppu::class_data*, void*, cppu::OWeakObject*) ()
   from
/home/lgodard/projets/libreoffice/build/git/master/libo/solver/unxlngi6.pro/installation/opt/program/../ure-link/lib/libuno_cppuhelpergcc3.so.3
#3  0xb79a3bd2 in ?? () from
/home/lgodard/projets/libreoffice/build/git/master/libo/solver/unxlngi6.pro/installation/opt/program/libsfxlo.so
#4  0xb7995d8d in SfxBaseModel::queryInterface(com::sun::star::uno::Type
const&) () from
/home/lgodard/projets/libreoffice/build/git/master/libo/solver/unxlngi6.pro/installation/opt/program/libsfxlo.so
#5  0xae0b5c43 in ScModelObj::queryInterface(com::sun::star::uno::Type
const&) ()
   from
/home/lgodard/projets/libreoffice/build/git/master/libo/solver/unxlngi6.pro/installation/opt/program/../program/libsclo.so
#6  0xb68f1794 in ?? () from
/home/lgodard/projets/libreoffice/build/git/master/libo/solver/unxlngi6.pro/installation/opt/program/libfwelo.so
#7  0xb69080fb in ?? () from
/home/lgodard/projets/libreoffice/build/git/master/libo/solver/unxlngi6.pro/installation/opt/program/libfwelo.so
#8  0xb6906eef in
framework::TitleHelper::impl_updateTitleForModel(com::sun::star::uno::Reference<com::sun::star::frame::XModel>
const&) ()
   from
/home/lgodard/projets/libreoffice/build/git/master/libo/solver/unxlngi6.pro/installation/opt/program/libfwelo.so
#9  0xb69076d8 in framework::TitleHelper::impl_updateTitle() () from
/home/lgodard/projets/libreoffice/build/git/master/libo/solver/unxlngi6.pro/installation/opt/program/libfwelo.so
#10 0xb69079be in framework::TitleHelper::getTitle() () from
/home/lgodard/projets/libreoffice/build/git/master/libo/solver/unxlngi6.pro/installation/opt/program/libfwelo.so
#11 0xb799ff10 in SfxBaseModel::getTitle() () from
/home/lgodard/projets/libreoffice/build/git/master/libo/solver/unxlngi6.pro/installation/opt/program/libsfxlo.so
#12 0xb69073cb in
framework::TitleHelper::impl_updateTitleForController(com::sun::star::uno::Reference<com::sun::star::frame::XController>
const&) ()
   from
/home/lgodard/projets/libreoffice/build/git/master/libo/solver/unxlngi6.pro/installation/opt/program/libfwelo.so
#13 0xb69076ec in framework::TitleHelper::impl_updateTitle() () from
/home/lgodard/projets/libreoffice/build/git/master/libo/solver/unxlngi6.pro/installation/opt/program/libfwelo.so
#14 0xb690791a in
framework::TitleHelper::titleChanged(com::sun::star::frame::TitleChangedEvent
const&) ()
   from
/home/lgodard/projets/libreoffice/build/git/master/libo/solver/unxlngi6.pro/installation/opt/program/libfwelo.so
#15 0xb690598a in framework::TitleHelper::impl_sendTitleChangedEvent()
() from
/home/lgodard/projets/libreoffice/build/git/master/libo/solver/unxlngi6.pro/installation/opt/program/libfwelo.so
#16 0xb690714c in
framework::TitleHelper::impl_updateTitleForModel(com::sun::star::uno::Reference<com::sun::star::frame::XModel>
const&) ()
   from
/home/lgodard/projets/libreoffice/build/git/master/libo/solver/unxlngi6.pro/installation/opt/program/libfwelo.so
#17 0xb69076d8 in framework::TitleHelper::impl_updateTitle() () from
/home/lgodard/projets/libreoffice/build/git/master/libo/solver/unxlngi6.pro/installation/opt/program/libfwelo.so
#18 0xb69079be in framework::TitleHelper::getTitle() () from
/home/lgodard/projets/libreoffice/build/git/master/libo/solver/unxlngi6.pro/installation/opt/program/libfwelo.so
#19 0xb799ff10 in SfxBaseModel::getTitle() () from
/home/lgodard/projets/libreoffice/build/git/master/libo/solver/unxlngi6.pro/installation/opt/program/libsfxlo.so
#20 0xb69073cb in
framework::TitleHelper::impl_updateTitleForController(com::sun::star::uno::Reference<com::sun::star::frame::XController>
const&) ()
   from
/home/lgodard/projets/libreoffice/build/git/master/libo/solver/unxlngi6.pro/installation/opt/program/libfwelo.so
#21 0xb69076ec in framework::TitleHelper::impl_updateTitle() () from
/home/lgodard/projets/libreoffice/build/git/master/libo/solver/unxlngi6.pro/installation/opt/program/libfwelo.so
#22 0xb690791a in
framework::TitleHelper::titleChanged(com::sun::star::frame::TitleChangedEvent
const&) ()
   from
/home/lgodard/projets/libreoffice/build/git/master/libo/solver/unxlngi6.pro/installation/opt/program/libfwelo.so
#23 0xb690598a in framework::TitleHelper::impl_sendTitleChangedEvent()
() from
/home/lgodard/projets/libreoffice/build/git/master/libo/solver/unxlngi6.pro/installation/opt/program/libfwelo.so
#24 0xb690714c in
framework::TitleHelper::impl_updateTitleForModel(com::sun::star::uno::Reference<com::sun::star::frame::XModel>
const&) ()
   from
/home/lgodard/projets/libreoffice/build/git/master/libo/solver/unxlngi6.pro/installation/opt/program/libfwelo.so
#25 0xb69076d8 in framework::TitleHelper::impl_updateTitle() () from
/home/lgodard/projets/libreoffice/build/git/master/libo/solver/unxlngi6.pro/installation/opt/program/libfwelo.so
#26 0xb69079be in framework::TitleHelper::getTitle() () from
/home/lgodard/projets/libreoffice/build/git/master/libo/solver/unxlngi6.pro/installation/opt/program/libfwelo.so



More information about the LibreOffice mailing list