[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.4' - sd/source

Michael Meeks (via logerrit) logerrit at kemper.freedesktop.org
Fri Jun 25 16:24:10 UTC 2021


 sd/source/filter/pdf/sdpdffilter.cxx |    5 +++++
 1 file changed, 5 insertions(+)

New commits:
commit 18264abc2d0cd56c1838e71045d5d11b3e0aa947
Author:     Michael Meeks <michael.meeks at collabora.com>
AuthorDate: Fri Jun 25 10:31:28 2021 +0100
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Fri Jun 25 18:23:30 2021 +0200

    pdf import: handle out of memory / failure to duplicate page.
    
    Avoid some reported segv's from null pages.
    
    Change-Id: Ic336b36fb57dc70fff183cd5aa5f3f3ef4562674
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117872
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Gökay ŞATIR <gokaysatir at collabora.com>

diff --git a/sd/source/filter/pdf/sdpdffilter.cxx b/sd/source/filter/pdf/sdpdffilter.cxx
index 6bc036f7fa21..290eea440e3c 100644
--- a/sd/source/filter/pdf/sdpdffilter.cxx
+++ b/sd/source/filter/pdf/sdpdffilter.cxx
@@ -71,12 +71,17 @@ bool SdPdfFilter::Import()
 
         // Create the page and insert the Graphic.
         SdPage* pPage = mrDocument.GetSdPage(nPageNumber, PageKind::Standard);
+        if (!pPage) // failed to duplicate page, out of memory?
+            return false;
 
         // Make the page size match the rendered image.
         pPage->SetSize(aSizeHMM);
 
         SdrGrafObj* pSdrGrafObj = new SdrGrafObj(pPage->getSdrModelFromSdrPage(), rGraphic,
                                                  tools::Rectangle(Point(), aSizeHMM));
+        if (!pSdrGrafObj) // out of memory
+            return false;
+
         pPage->InsertObject(pSdrGrafObj);
 
         for (auto const& rPDFAnnotation : rPDFGraphicResult.maAnnotations)


More information about the Libreoffice-commits mailing list