diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2023-12-05 11:43:42 +0100 |
---|---|---|
committer | Caolán McNamara <caolan.mcnamara@collabora.com> | 2023-12-05 12:58:44 +0100 |
commit | 2f4938caebc5e8b5c7dcce45b9a5191794ceffcd (patch) | |
tree | 396b763a1d93bcadb0b03f025fdbb3245fa9d0c7 | |
parent | 902c9a5fcaca2dce59f7ad0c55e512598507bb18 (diff) |
writerfilter: fix crash in DomainMapper_Impl::PushSdt()co-23.05.6-2
Crashreport signature:
Fatal signal received: SIGSEGV code: 1 for address: 0x0
program/libwriterfilterlo.so
writerfilter::dmapper::DomainMapper_Impl::PushSdt()
writerfilter/source/dmapper/DomainMapper_Impl.cxx:987
program/libwriterfilterlo.so
writerfilter::dmapper::DomainMapper::lcl_attribute(unsigned int, writerfilter::Value&)
include/tools/ref.hxx:56
program/libwriterfilterlo.so
writerfilter::ooxml::OOXMLProperty::resolve(writerfilter::Properties&)
include/tools/ref.hxx:56
program/libwriterfilterlo.so
writerfilter::ooxml::OOXMLPropertySet::resolve(writerfilter::Properties&)
include/tools/ref.hxx:157
Change-Id: I76416ca707a4ac40495e5c22f62fcd017bcb5e48
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160336
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Tested-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
-rw-r--r-- | writerfilter/source/dmapper/DomainMapper_Impl.cxx | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index f3558bfeac1e..897ff2f83eca 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -983,8 +983,19 @@ void DomainMapper_Impl::PushSdt() } uno::Reference<text::XTextAppend> xTextAppend = m_aTextAppendStack.top().xTextAppend; + if (!xTextAppend.is()) + { + return; + } + + uno::Reference<text::XText> xText = xTextAppend->getText(); + if (!xText.is()) + { + return; + } + uno::Reference<text::XTextCursor> xCursor - = xTextAppend->getText()->createTextCursorByRange(xTextAppend->getEnd()); + = xText->createTextCursorByRange(xTextAppend->getEnd()); // Offset so the cursor is not adjusted as we import the SDT's content. bool bStart = !xCursor->goLeft(1, /*bExpand=*/false); m_xSdtStarts.push({bStart, OUString(), xCursor->getStart()}); |