[Libreoffice-commits] core.git: Branch 'libreoffice-6-4' - sw/source
Michael Stahl (via logerrit)
logerrit at kemper.freedesktop.org
Tue Mar 31 00:11:12 UTC 2020
sw/source/filter/ww8/docxattributeoutput.cxx | 10 ++++++++++
1 file changed, 10 insertions(+)
New commits:
commit 1577d2900302e7c74559f0c5dbb5a22e95933432
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Fri Mar 27 13:49:09 2020 +0100
Commit: Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Tue Mar 31 02:10:41 2020 +0200
sw: DOCX export: ignore linked image with invalid URL
Word 2013 refuses to open DOCX files with image urls that contain %5C
(encoded '\') in path or query (fragment is not a problem).
Just don't export such images, they won't work anyway.
Change-Id: Iae918791beb8532e76b4f29d49eba6fe0eda8aa8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91204
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl at cib.de>
(cherry picked from commit 65284c03757f70478f04aedd4ed7f4062a7c5516)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91179
Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 99aad24c3da2..a88cb7ce30ab 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -4833,6 +4833,16 @@ void DocxAttributeOutput::FlyFrameGraphic( const SwGrfNode* pGrfNode, const Size
OUString aFileName;
pGrfNode->GetFileFilterNms( &aFileName, nullptr );
+ sal_Int32 const nFragment(aFileName.indexOf('#'));
+ sal_Int32 const nForbiddenU(aFileName.indexOf("%5C"));
+ sal_Int32 const nForbiddenL(aFileName.indexOf("%5c"));
+ if ( (nForbiddenU != -1 && (nFragment == -1 || nForbiddenU < nFragment))
+ || (nForbiddenL != -1 && (nFragment == -1 || nForbiddenL < nFragment)))
+ {
+ SAL_WARN("sw.ww8", "DocxAttributeOutput::FlyFrameGraphic: ignoring image with invalid link URL");
+ return;
+ }
+
// TODO Convert the file name to relative for better interoperability
aRelId = m_rExport.AddRelation(
More information about the Libreoffice-commits
mailing list