diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2024-08-23 17:35:59 +0200 |
---|---|---|
committer | Adolfo Jayme Barrientos <fitojb@ubuntu.com> | 2024-08-26 03:52:32 +0200 |
commit | 24304cc6abc2f583b0fcf47e8030a9c8d985f9a9 (patch) | |
tree | b8120c64cefaae25db0ab53a4cbe1a55f5391596 | |
parent | 76d9da6593af6a7435941ac44b945c0d484103e1 (diff) |
tdf#162586: Check GetUpper is not nullptr
Change-Id: I3d56edda8de16a2d04d8f902d3db340fc191a506
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172322
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
(cherry picked from commit 659842c2048aad10e7793f5e80fdc4956d9274d3)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172274
Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
-rw-r--r-- | sw/source/core/text/EnhancedPDFExportHelper.cxx | 5 | ||||
-rw-r--r-- | vcl/qa/cppunit/pdfexport/data/tdf162586.odt | bin | 0 -> 15554 bytes | |||
-rw-r--r-- | vcl/qa/cppunit/pdfexport/pdfexport.cxx | 6 |
3 files changed, 9 insertions, 2 deletions
diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx b/sw/source/core/text/EnhancedPDFExportHelper.cxx index acaa18350073..cbbc083228a0 100644 --- a/sw/source/core/text/EnhancedPDFExportHelper.cxx +++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx @@ -769,8 +769,9 @@ void SwTaggedPDFHelper::SetAttributes( vcl::PDFWriter::StructElement eType ) if (vcl::PDFWriter::Figure == eType) { const SwFrame* pKeyFrame = static_cast<const SwFlyFrame&>(*pFrame).GetAnchorFrame(); - if (pKeyFrame->GetUpper()->GetType() == SwFrameType::Body) - bIsFigureInline = true; + if (const SwLayoutFrame* pUpperFrame = pKeyFrame->GetUpper()) + if (pUpperFrame->GetType() == SwFrameType::Body) + bIsFigureInline = true; } eVal = vcl::PDFWriter::TableHeader == eType || vcl::PDFWriter::TableData == eType diff --git a/vcl/qa/cppunit/pdfexport/data/tdf162586.odt b/vcl/qa/cppunit/pdfexport/data/tdf162586.odt Binary files differnew file mode 100644 index 000000000000..ff523ff70663 --- /dev/null +++ b/vcl/qa/cppunit/pdfexport/data/tdf162586.odt diff --git a/vcl/qa/cppunit/pdfexport/pdfexport.cxx b/vcl/qa/cppunit/pdfexport/pdfexport.cxx index e2fbcefe5541..2e047f27fdff 100644 --- a/vcl/qa/cppunit/pdfexport/pdfexport.cxx +++ b/vcl/qa/cppunit/pdfexport/pdfexport.cxx @@ -1973,6 +1973,12 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testForcePoint3) saveAsPDF(u"flowframe_null_ptr_deref.sample"); } +CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf162586) +{ + // Without the fix in place, this test would have crashed + saveAsPDF(u"tdf162586.odt"); +} + CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf84283) { // Without the fix in place, this test would have crashed |