Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prevent attempts to create UCB content from .component URIs
After commit 86c6822 (tdf#96401: allow to detect a broken ZIP package, 2023-11-26) impl_openStream is called from TypeDetection::impl_detectTypeFlatAndDeep for URIs like ".component:Bibliography/View1". For some reasons, sometimes GIO UCP tries to handle these URIs; failing that, it shows an error message. This started to fail UITest_writer_tests4 (specifically, test for tdf92611), like this: Thread 1 (Thread 0x7f51cd99b1c0 (LWP 1424555) "soffice.bin"): #10 std::condition_variable::wait_for<long int, std::ratio<1, 1000>, SvpSalInstance::ImplYield(bool, bool)::<lambda()> > (__rtime=<optimized out>, __p=..., __lock=..., this=0x13d78e0) at ~/gcc/inst/include/c++/14.0.0/condition_variable:177 #11 SvpSalInstance::ImplYield(bool, bool) (this=this@entry=0x13d7690, bWait=bWait@entry=true, bHandleAllCurrentEvents=bHandleAllCurrentEvents@entry=false) at vcl/headless/svpinst.cxx:451 #12 0x00007f51d9d85695 in SvpSalInstance::DoYield(bool, bool) (this=0x13d7690, bWait=<optimized out>, bHandleAllCurrentEvents=<optimized out>) at vcl/headless/svpinst.cxx:471 #13 0x00007f51d9add654 in ImplYield(bool, bool) (i_bWait=i_bWait@entry=true, i_bAllEvents=i_bAllEvents@entry=false) at vcl/source/app/svapp.cxx:390 #14 0x00007f51d9addc73 in Application::Yield() () at vcl/source/app/svapp.cxx:474 #15 0x00007f51d946de4f in Dialog::Execute() (this=0x14554e40) at vcl/source/window/dialog.cxx:1078 #16 0x00007f51d9a5ccec in virtual thunk to SalInstanceDialog::run() () at vcl/inc/salvtables.hxx:543 #17 0x00007f51d92b45b2 in (anonymous namespace)::executeErrorDialog (nButtonMask=(anonymous namespace)::MessageBoxStyle::Ok, rMessage=Python Exception <class 'gdb.error'>: value has been optimized out , rContext=Python Exception <class 'gdb.error'>: value has been optimized out , eClassification=com::sun::star::task::InteractionClassification::InteractionClassification_ERROR, pParent=<optimized out>) at uui/source/iahndl-errorhandler.cxx:123 #18 UUIInteractionHelper::handleErrorHandlerRequest(com::sun::star::task::InteractionClassification, ErrCode, std::__debug::vector<rtl::OUString, std::allocator<rtl::OUString> > const&, com::sun::star::uno::Sequence<com::sun::star::uno::Reference<com::sun::star::task::XInteractionContinuation> > const&, bool, bool&, rtl::OUString&) (this=this@entry=0x1408c9a8, eClassification=com::sun::star::task::InteractionClassification::InteractionClassification_ERROR, nErrorCode=..., nErrorCode@entry=..., rArguments=std::__debug::vector of length 0, capacity 0, rContinuations=uno::Sequence of length 1 = {...}, bObtainErrorStringOnly=bObtainErrorStringOnly@entry=false, bHasErrorString=@0x7ffd36859b90: false, rErrorString="") at uui/source/iahndl-errorhandler.cxx:250 #19 0x00007f51d92bbcd5 in UUIInteractionHelper::handleInteractiveIOException(com::sun::star::uno::Reference<com::sun::star::task::XInteractionRequest> const&, bool, bool&, rtl::OUString&) (this=this@entry=0x1408c9a8, rRequest=uno::Reference to (ucbhelper::InteractionRequest *) 0x136bdcc8, bObtainErrorStringOnly=bObtainErrorStringOnly@entry=false, bHasErrorString=@0x7ffd36859b90: false, rErrorString="") at uui/source/iahndl-ioexceptions.cxx:265 #20 0x00007f51d92a9e33 in UUIInteractionHelper::handleRequest_impl(com::sun::star::uno::Reference<com::sun::star::task::XInteractionRequest> const&, bool, bool&, rtl::OUString&) (this=this@entry=0x1408c9a8, rRequest=uno::Reference to (ucbhelper::InteractionRequest *) 0x136bdcc8, bObtainErrorStringOnly=bObtainErrorStringOnly@entry=false, bHasErrorString=@0x7ffd36859b90: false, rErrorString="") at uui/source/iahndl.cxx:474 #21 0x00007f51d92aca90 in UUIInteractionHelper::handleRequest(com::sun::star::uno::Reference<com::sun::star::task::XInteractionRequest> const&) (this=this@entry=0x1408c9a8, rRequest=uno::Reference to (ucbhelper::InteractionRequest *) 0x136bdcc8) at uui/source/iahndl.cxx:177 #22 0x00007f51d92c2d36 in (anonymous namespace)::UUIInteractionHandler::handle(com::sun::star::uno::Reference<com::sun::star::task::XInteractionRequest> const&) (this=0x1408c960, rRequest=<optimized out>) at uui/source/interactionhandler.cxx:194 #23 0x00007f51d8ff8607 in ucbhelper::cancelCommandExecution(com::sun::star::uno::Any const&, com::sun::star::uno::Reference<com::sun::star::ucb::XCommandEnvironment> const&) (rException=uno::Any("com.sun.star.ucb.InteractiveAugmentedIOException": ...), xEnv=uno::Reference to (ucbhelper::CommandEnvironment *) 0x1494c7e8) at ucbhelper/source/provider/cancelcommandexecution.cxx:52 #24 0x00007f5197fd8ddd in gio::Content::getFileInfo(com::sun::star::uno::Reference<com::sun::star::ucb::XCommandEnvironment> const&, _GFileInfo**, bool) (this=0x13658da0, env=uno::Reference to (ucbhelper::CommandEnvironment *) 0x1494c7e8, info=<optimized out>, fail=<optimized out>) at ucb/source/ucp/gio/gio_content.cxx:652 #25 0x00007f5197fdf515 in gio::Content::getPropertyValues(com::sun::star::uno::Sequence<com::sun::star::beans::Property> const&, com::sun::star::uno::Reference<com::sun::star::ucb::XCommandEnvironment> const&) (this=this@entry=0x13658da0, rProperties=uno::Sequence of length 1 = {...}, xEnv=uno::Reference to (ucbhelper::CommandEnvironment *) 0x1494c7e8) at ucb/source/ucp/gio/gio_content.cxx:448 #26 0x00007f5197fe031e in gio::Content::execute(com::sun::star::ucb::Command const&, int, com::sun::star::uno::Reference<com::sun::star::ucb::XCommandEnvironment> const&) (this=0x13658da0, aCommand=<optimized out>, xEnv=uno::Reference to (ucbhelper::CommandEnvironment *) 0x1494c7e8) at ucb/source/ucp/gio/gio_content.cxx:951 #27 0x00007f51d8fe73ad in ucbhelper::Content_Impl::executeCommand(com::sun::star::ucb::Command const&) (this=0x142235a0, rCommand=...) at ucbhelper/source/client/content.cxx:1264 #28 0x00007f51d8fe8607 in ucbhelper::Content::getPropertyValuesInterface(com::sun::star::uno::Sequence<rtl::OUString> const&) (this=this@entry=0x7ffd3685a6d0, rPropertyNames=uno::Sequence of length 1 = {...}) at ucbhelper/source/client/content.cxx:500 #29 0x00007f51d8fe88ba in ucbhelper::Content::getPropertyValues(com::sun::star::uno::Sequence<rtl::OUString> const&) (this=this@entry=0x7ffd3685a6d0, rPropertyNames=uno::Sequence of length 1 = {...}) at ucbhelper/source/client/content.cxx:458 #30 0x00007f51d8fe8b37 in ucbhelper::Content::getPropertyValue(rtl::OUString const&) (this=this@entry=0x7ffd3685a6d0, rPropertyName="IsDocument") at ucbhelper/source/client/content.cxx:437 #31 0x00007f51d8fe9282 in ucbhelper::Content::isDocument() (this=this@entry=0x7ffd3685a6d0) at ucbhelper/source/client/content.cxx:1028 #32 0x00007f51d8feac5d in ucbhelper::Content::openStream() (this=this@entry=0x7ffd3685a6d0) at ucbhelper/source/client/content.cxx:693 #33 0x00007f51d9274d77 in utl::MediaDescriptor::impl_openStreamWithURL(rtl::OUString const&, bool) (this=this@entry=0x7ffd3685b400, sURL=".component:Bibliography/View1", bLockFile=bLockFile@entry=true) at unotools/source/misc/mediadescriptor.cxx:468 #34 0x00007f51d9275951 in utl::MediaDescriptor::impl_addInputStream(bool) (this=0x7ffd3685b400, bLockFile=bLockFile@entry=true) at unotools/source/misc/mediadescriptor.cxx:259 #35 0x00007f51d927685a in utl::MediaDescriptor::addInputStream() (this=<optimized out>) at unotools/source/misc/mediadescriptor.cxx:220 #36 0x00007f51d69a7745 in filter::config::TypeDetection::impl_openStream(utl::MediaDescriptor&) (this=this@entry=0x143f7da0, rDescriptor=...) at filter/source/config/cache/typedetection.cxx:1202 #37 0x00007f51d69a9238 in filter::config::TypeDetection::impl_detectTypeFlatAndDeep(utl::MediaDescriptor&, std::__debug::vector<filter::config::FlatDetectionInfo, std::allocator<filter::config::FlatDetectionInfo> > const&, bool, rtl::OUString&) (this=this@entry=0x143f7da0, rDescriptor=..., lFlatTypes=std::__debug::vector of length 180, capacity 256 = {...}, bAllowDeep=bAllowDeep@entry=true, rLastChance="") at filter/source/config/cache/typedetection.cxx:902 #38 0x00007f51d69b971f in filter::config::TypeDetection::queryTypeByDescriptor(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>&, unsigned char) (this=0x143f7da0, lDescriptor=uno::Sequence of length 6 = {...}, bAllowDeep=1 '\001') at filter/source/config/cache/typedetection.cxx:434 #39 0x00007f51d6ec41ee in framework::LoadEnv::impl_detectTypeAndFilter() (this=this@entry=0x14501c08) at framework/source/loadenv/loadenv.cxx:774 #40 0x00007f51d6ec5446 in framework::LoadEnv::start() (this=this@entry=0x14501c08) at framework/source/loadenv/loadenv.cxx:395 #41 0x00007f51d6ec5b67 in framework::LoadEnv::startLoading(rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&, com::sun::star::uno::Reference<com::sun::star::frame::XFrame> const&, rtl::OUString const&, int, LoadEnvFeatures) (this=this@entry=0x14501c08, sURL=".component:Bibliography/View1", lMediaDescriptor=uno::Sequence of length 5 = {...}, xBaseFrame=uno::Reference to (framework::Desktop *) 0x16a8908, sTarget="_blank", nSearchFlags=0, eFeature=(LoadEnvFeatures::WorkWithUI | LoadEnvFeatures::AllowContentHandler)) at framework/source/loadenv/loadenv.cxx:308 #42 0x00007f51d6d88634 in framework::LoadDispatcher::impl_dispatch(com::sun::star::util::URL const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&, com::sun::star::uno::Reference<com::sun::star::frame::XDispatchResultListener> const&) (this=0x14501bb0, rURL=..., lArguments=uno::Sequence of length 5 = {...}, xListener=empty uno::Reference) at framework/source/dispatch/loaddispatcher.cxx:107 #43 0x00007f51d6d8987b in non-virtual thunk to framework::LoadDispatcher::dispatch(com::sun::star::util::URL const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) () at framework/source/inc/dispatch/loaddispatcher.hxx:99 #44 0x00007f51d761f4d3 in SfxApplication::OpenDocExec_Impl(SfxRequest&) (this=<optimized out>, rReq=<optimized out>) at sfx2/source/appl/appopen.cxx:1097 #45 0x00007f51d77065c2 in SfxDispatcher::Call_Impl(SfxShell&, SfxSlot const&, SfxRequest&, bool) (this=this@entry=0x2cf43b0, rShell=..., rSlot=..., rReq=..., bRecord=false) at sfx2/source/control/dispatch.cxx:254 #46 0x00007f51d7711618 in SfxDispatcher::PostMsgHandler(std::unique_ptr<SfxRequest, std::default_delete<SfxRequest> >) (this=0x2cf43b0, pReq=std::unique_ptr<SfxRequest> = {...}) at ~/gcc/inst/include/c++/14.0.0/bits/unique_ptr.h:193 #47 0x00007f51d7713d74 in std::__invoke_impl<void, void (SfxDispatcher::*&)(std::unique_ptr<SfxRequest, std::default_delete<SfxRequest> >), SfxDispatcher*&, std::unique_ptr<SfxRequest, std::default_delete<SfxRequest> > >(std::__invoke_memfun_deref, void (SfxDispatcher::*&)(std::unique_ptr<SfxRequest, std::default_delete<SfxRequest> >), SfxDispatcher*&, std::unique_ptr<SfxRequest, std::default_delete<SfxRequest> >&&) (__f=<optimized out>, __t=<optimized out>) at ~/gcc/inst/include/c++/14.0.0/bits/unique_ptr.h:191 #48 std::__invoke<void (SfxDispatcher::*&)(std::unique_ptr<SfxRequest, std::default_delete<SfxRequest> >), SfxDispatcher*&, std::unique_ptr<SfxRequest, std::default_delete<SfxRequest> > >(void (SfxDispatcher::*&)(std::unique_ptr<SfxRequest, std::default_delete<SfxRequest> >), SfxDispatcher*&, std::unique_ptr<SfxRequest, std::default_delete<SfxRequest> >&&) (__fn=<optimized out>) at ~/gcc/inst/include/c++/14.0.0/bits/invoke.h:96 #49 std::_Bind<void (SfxDispatcher::*(SfxDispatcher*, std::_Placeholder<1>))(std::unique_ptr<SfxRequest, std::default_delete<SfxRequest> >)>::__call<void, std::unique_ptr<SfxRequest, std::default_delete<SfxRequest> >&&, 0ul, 1ul>(std::tuple<std::unique_ptr<SfxRequest, std::default_delete<SfxRequest> >&&>&&, std::_Index_tuple<0ul, 1ul>) (__args=<optimized out>, this=<optimized out>) at ~/gcc/inst/include/c++/14.0.0/functional:511 #50 std::_Bind<void (SfxDispatcher::*(SfxDispatcher*, std::_Placeholder<1>))(std::unique_ptr<SfxRequest, std::default_delete<SfxRequest> >)>::operator()<std::unique_ptr<SfxRequest, std::default_delete<SfxRequest> >, void>(std::unique_ptr<SfxRequest, std::default_delete<SfxRequest> >&&) (this=<optimized out>) at ~/gcc/inst/include/c++/14.0.0/functional:596 #51 std::__invoke_impl<void, std::_Bind<void (SfxDispatcher::*(SfxDispatcher*, std::_Placeholder<1>))(std::unique_ptr<SfxRequest, std::default_delete<SfxRequest> >)>&, std::unique_ptr<SfxRequest, std::default_delete<SfxRequest> > >(std::__invoke_other, std::_Bind<void (SfxDispatcher::*(SfxDispatcher*, std::_Placeholder<1>))(std::unique_ptr<SfxRequest, std::default_delete<SfxRequest> >)>&, std::unique_ptr<SfxRequest, std::default_delete<SfxRequest> >&&) (__f=<optimized out>) at ~/gcc/inst/include/c++/14.0.0/bits/invoke.h:61 #52 std::__invoke_r<void, std::_Bind<void (SfxDispatcher::*(SfxDispatcher*, std::_Placeholder<1>))(std::unique_ptr<SfxRequest, std::default_delete<SfxRequest> >)>&, std::unique_ptr<SfxRequest, std::default_delete<SfxRequest> > >(std::_Bind<void (SfxDispatcher::*(SfxDispatcher*, std::_Placeholder<1>))(std::unique_ptr<SfxRequest, std::default_delete<SfxRequest> >)>&, std::unique_ptr<SfxRequest, std::default_delete<SfxRequest> >&&) (__fn=<optimized out>) at ~/gcc/inst/include/c++/14.0.0/bits/invoke.h:111 #53 std::_Function_handler<void (std::unique_ptr<SfxRequest, std::default_delete<SfxRequest> >), std::_Bind<void (SfxDispatcher::*(SfxDispatcher*, std::_Placeholder<1>))(std::unique_ptr<SfxRequest, std::default_delete<SfxRequest> >)> >::_M_invoke(std::_Any_data const&, std::unique_ptr<SfxRequest, std::default_delete<SfxRequest> >&&) (__functor=<optimized out>, __args#0=<optimized out>) at ~/gcc/inst/include/c++/14.0.0/bits/std_function.h:290 #54 0x00007f51d7a6aa83 in std::function<void (std::unique_ptr<SfxRequest, std::default_delete<SfxRequest> >)>::operator()(std::unique_ptr<SfxRequest, std::default_delete<SfxRequest> >) const (__args#0=std::unique_ptr<SfxRequest> = {...}, this=0x134550c0) at ~/gcc/inst/include/c++/14.0.0/bits/std_function.h:591 #55 SfxHintPoster::DoEvent_Impl(void*) (this=0x134550b0, pPostedHint=0x7f5174a248b0) at sfx2/source/notify/hintpost.cxx:43 #56 0x00007f51d9590f30 in Link<void*, void>::Call(void*) const (data=<optimized out>, this=0x7f51748c59b8) at include/tools/link.hxx:111 #57 ImplHandleUserEvent (pSVEvent=0x7f51748c59b0) at vcl/source/window/winproc.cxx:2287 #58 ImplWindowFrameProc(vcl::Window*, SalEvent, void const*) (_pWindow=0x284cc10, nEvent=SalEvent::UserEvent, pEvent=0x7f51748c59b0) at vcl/source/window/winproc.cxx:2851 #59 0x00007f51d9d8488f in SalFrame::CallCallback(SalEvent, void const*) const (pEvent=0x7f51748c59b0, nEvent=SalEvent::UserEvent, this=0x284f1c0) at include/rtl/ref.hxx:206 #60 SvpSalInstance::ProcessEvent(SalUserEventList::SalUserEvent) (this=0x13d7690, aEvent=...) at vcl/headless/svpinst.cxx:266 #61 0x00007f51d9a4b216 in operator() (__closure=<synthetic pointer>) at vcl/source/app/salusereventlist.cxx:119 #62 SalUserEventList::DispatchUserEvents(bool) (this=this@entry=0x13d76b8, bHandleAllCurrentEvents=bHandleAllCurrentEvents@entry=false) at vcl/source/app/salusereventlist.cxx:120 #63 0x00007f51d9d84fc3 in SvpSalInstance::ImplYield(bool, bool) (this=this@entry=0x13d7690, bWait=bWait@entry=true, bHandleAllCurrentEvents=bHandleAllCurrentEvents@entry=false) at vcl/headless/svpinst.cxx:395 #64 0x00007f51d9d85695 in SvpSalInstance::DoYield(bool, bool) (this=0x13d7690, bWait=<optimized out>, bHandleAllCurrentEvents=<optimized out>) at vcl/headless/svpinst.cxx:471 #65 0x00007f51d9add654 in ImplYield(bool, bool) (i_bWait=true, i_bAllEvents=false) at vcl/source/app/svapp.cxx:390 #66 0x00007f51d9addd8d in Application::Execute() () at vcl/source/app/svapp.cxx:368 #67 0x00007f51d7bce212 in desktop::Desktop::Main() (this=0x7ffd3685d0c0) at desktop/source/app/app.cxx:1601 #68 0x00007f51d9af112b in ImplSVMain() () at vcl/source/app/svmain.cxx:229 #69 0x00007f51d9af13b5 in SVMain() () at vcl/source/app/svmain.cxx:261 #70 0x00007f51d7c03c37 in soffice_main() () at desktop/source/app/sofficemain.cxx:94 #71 0x000000000040078b in sal_main () at desktop/source/app/main.c:51 #72 main (argc=argc@entry=7, argv=argv@entry=0x7ffd3685d2c8) at desktop/source/app/main.c:49 Strangely, this is inconsistent on Linux systems (shows on some systems, but not on others). Prevent this exiting from MediaDescriptor::impl_openStreamWithURL early for these URIs. Thank Stephan Bergmann for the help understanding it and deciding how to fix it. Change-Id: I84c551916e6643eeb219f23ff778d4418eea9124 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160057 Tested-by: Jenkins Reviewed-by: Mike Kaganski <[email protected]>
- Loading branch information