summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolan.mcnamara@collabora.com>2024-12-05 12:56:34 +0000
committerChristian Lohmaier <lohmaier+LibreOffice@googlemail.com>2024-12-10 16:06:05 +0100
commitffee78c6839b6c305b124954ff9dc3cb411360fb (patch)
tree54ffdc16e042657a3fca634891486b8520dc79f4
parent79f43f7a2fbe6daaff4507bf2856322824c0c09b (diff)
crashtesting: HLINK embedded null import from ooo98294-1.doc
which causes problems on export to docx. Sanitize at the original import. Change-Id: I3b5521dac6a2b6926db6362d33500b11f0a69098 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177870 Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org> Tested-by: Jenkins (cherry picked from commit 47a9360de91bb50c19a0d5f2e8408042931933ab) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177890 Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com> Tested-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com> Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
-rw-r--r--sw/source/filter/ww8/ww8par.cxx11
1 files changed, 11 insertions, 0 deletions
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index 138bbf26127b..2ed6ce9fd383 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -216,6 +216,15 @@ namespace
}
}
+// returns true if an embedded null was found
+static bool clipToFirstNull(OUString& rStr)
+{
+ sal_Int32 nEmbeddedNullIdx = rStr.indexOf(0);
+ if (nEmbeddedNullIdx != -1)
+ rStr = rStr.copy(0, nEmbeddedNullIdx);
+ return nEmbeddedNullIdx != -1;
+}
+
void SwWW8ImplReader::ReadEmbeddedData(SvStream& rStrm, SwDocShell const * pDocShell, struct HyperLinksTable& hlStr)
{
// (0x01B8) HLINK
@@ -347,6 +356,8 @@ void SwWW8ImplReader::ReadEmbeddedData(SvStream& rStrm, SwDocShell const * pDocS
if (xLongName)
{
+ if (clipToFirstNull(*xLongName))
+ SAL_WARN("sw.ww8", "HLINK with embedded null, truncating to: " << *xLongName);
if (xTextMark)
{
if (xLongName->isEmpty())