From 2c410a04c15c21eb025ae5df0f70f63df9757cca Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Thu, 24 Aug 2017 13:56:35 +0200 Subject: tdf#111934 xmloff: ODF import: self-referential conditional style crash MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It's invalid input and also causes stack overflow. (cherry picked from commit 9fe857b7bd126ff4856fc4689d375881653b97a2) tdf#111934: add document for filters-tests Thanks to infostud91@gmail.com for the document; unfortunately git tells me that i can't set the commit author to just an email address. (cherry picked from commit 6e090b4272b8fa12d2032ff0c0ea4bfb24c0d2d2) Change-Id: Ie0b9dcaefcfcf254326151f345f4802ed66b994d Reviewed-on: https://gerrit.libreoffice.org/41535 Tested-by: Jenkins Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara (cherry picked from commit f07bb0fed885f7a13c08f2bc3203e727db7cef1c) --- xmloff/source/style/xmlnumfi.cxx | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'xmloff') diff --git a/xmloff/source/style/xmlnumfi.cxx b/xmloff/source/style/xmlnumfi.cxx index ccd8158ead14..85c6cfe47289 100644 --- a/xmloff/source/style/xmlnumfi.cxx +++ b/xmloff/source/style/xmlnumfi.cxx @@ -1692,6 +1692,11 @@ sal_Int32 SvXMLNumFormatContext::CreateAndInsert(SvNumberFormatter* pFormatter) { SvXMLNumFormatContext* pStyle = const_cast( static_cast(pStyles->FindStyleChildContext( XML_STYLE_FAMILY_DATA_STYLE, aMyConditions[i].sMapName))); + if (this == pStyle) + { + SAL_INFO("xmloff.style", "invalid style:map references containing style"); + pStyle = nullptr; + } if (pStyle) { if ((pStyle->PrivateGetKey() > -1)) // don't reset pStyle's bRemoveAfterUse flag -- cgit