oox/source/export/drawingml.cxx | 2 +- sfx2/source/control/unoctitm.cxx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
New commits: commit 4a7fea4fc10baf6987709a26c0e0121e24fe31f8 Author: Skyler Grey <[email protected]> AuthorDate: Mon Nov 18 14:20:29 2024 +0000 Commit: Andras Timar <[email protected]> CommitDate: Tue Nov 19 08:37:46 2024 +0100 fix(ooxmlexport): Prevent unknown media type crash To determine the extension of a media file, we just take whatever parts of the URL were left after the final dot. Normally this is something normal such as `mp4`, `mp3` or suchlike Unfortunately, sometimes (such as when in Collabora Online) this URL would is actually be something Uno-y, leaving an extension like Package:Media That's no good, because in Zip files we can't have colons in our names, at least according to our Zip file name checker, which looks through and denies access to any file names that have colons in bool OStorageHelper::IsValidZipEntryFileName( std::u16string_view aName, bool bSlashAllowed ) { long nDots{0}; for ( size_t i = 0; i < aName.size(); i++ ) { switch ( aName[i] ) { // ------------------ 8< cut ------------------ case ':': return false; Promptly causing us not to open a file output stream... if ( aElementName.isEmpty() || !::comphelper::OStorageHelper::IsValidZipEntryFileName( aElementName, false ) ) throw lang::IllegalArgumentException( THROW_WHERE "Unexpected entry name syntax.", uno::Reference< uno::XInterface >(), 1 ); -> leading to implOpenSubStorage failing to set xSubXStorage... if( mxStorage.is() ) try { // XStorage::isStorageElement may throw various exceptions... if( mxStorage->isStorageElement( rElementName ) ) xSubXStorage = mxStorage->openStorageElement( rElementName, css::embed::ElementModes::READ ); } catch ... { ... } ...and eventually to us never having an output stream in the first place... Reference<XOutputStream> xOutStream = mpFB->openFragmentStream(sFileName, aMimeType); gdb$ print xOutStream $1 = empty uno::Reference ...and crashing the code that tries to copy to that stream. The upshot of this bug is that any videos inserted with Collabora Online (or presumably similar .uno command use) crash LO when you later try to save your .pptx The quick fix here is to replace colons with another character, which is what I've done here. Future followup patches could do other sensible things like stopping crashes if we can't open an output stream for whatever reason or figuring out what to do with names that aren't permitted for reasons other than colon use. Change-Id: I9113b272d29f74882dc25bf6e74306bd9ecd58a2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176719 Tested-by: Jenkins CollaboraOffice <[email protected]> Reviewed-by: Szymon Kłos <[email protected]> diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index a3e5356c0523..c5e3f278ef8a 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -1631,7 +1631,7 @@ void DrawingML::WriteMediaNonVisualProperties(const css::uno::Reference<css::dra const OUString& rURL(pMediaObj->getURL()); int nLastDot = rURL.lastIndexOf('.'); if (nLastDot >= 0) - aExtension = rURL.copy(nLastDot); + aExtension = rURL.copy(nLastDot).replace(':', '_'); // Colons are not allowed in Zip entry file names, see OStorageHelper::IsValidZipEntryFileName bool bEmbed = rURL.startsWith("vnd.sun.star.Package:"); Relationship eMediaType = Relationship::VIDEO; commit fb0582eee4f93f930b5b85c4605ff18bafb2c4b9 Author: Pranam Lashkari <[email protected]> AuthorDate: Tue Nov 19 00:04:30 2024 +0530 Commit: Andras Timar <[email protected]> CommitDate: Tue Nov 19 08:37:14 2024 +0100 LOK: use boolean or disabled payload for EditDoc it is more appropriate state variable for this particular command, as in many cases its disabled and that can not be treated as false as document still maybe editable Change-Id: Ib19a0cc087518a18bf295abd08b93815606af1fa Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176736 Reviewed-by: Caolán McNamara <[email protected]> Tested-by: Jenkins CollaboraOffice <[email protected]> Tested-by: Caolán McNamara <[email protected]> diff --git a/sfx2/source/control/unoctitm.cxx b/sfx2/source/control/unoctitm.cxx index e898f565f8ff..acc4eb2de365 100644 --- a/sfx2/source/control/unoctitm.cxx +++ b/sfx2/source/control/unoctitm.cxx @@ -1152,7 +1152,6 @@ constexpr auto handlers = frozen::make_unordered_map<std::u16string_view, Payloa { u"NormalMultiPaneGUI", IsActivePayload }, { u"NotesMode", IsActivePayload }, { u"SlideMasterPage", IsActivePayload }, - { u"EditDoc", IsActivePayload }, { u"CharFontName", FontNamePayload }, @@ -1350,6 +1349,7 @@ constexpr auto handlers = frozen::make_unordered_map<std::u16string_view, Payloa { u"ToggleMergeCells", BooleanOrDisabledPayload }, { u"SheetRightToLeft", BooleanOrDisabledPayload }, { u"ToggleSheetGrid", BooleanOrDisabledPayload }, + { u"EditDoc", BooleanOrDisabledPayload }, { u"Position", PointPayload }, { u"FreezePanesColumn", PointPayload },
