diff options
author | Michael Meeks <michael.meeks@collabora.com> | 2021-06-25 10:31:28 +0100 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2021-06-25 16:11:41 +0200 |
commit | 4c267311ed7bedfd373db2afc12cad9757922ce1 (patch) | |
tree | 6c4f07c803288d06809ee0322ee0277b1873037e /sd | |
parent | 2e8b41a0b4b96053b3b61eef90b1a136884b2d96 (diff) |
pdf import: handle out of memory / failure to duplicate page.
Avoid some reported segv's from null pages.
Change-Id: Ic336b36fb57dc70fff183cd5aa5f3f3ef4562674
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117855
Tested-by: Jenkins
Diffstat (limited to 'sd')
-rw-r--r-- | sd/source/filter/pdf/sdpdffilter.cxx | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/sd/source/filter/pdf/sdpdffilter.cxx b/sd/source/filter/pdf/sdpdffilter.cxx index efa0a0bce0b5..9725bcc8b998 100644 --- a/sd/source/filter/pdf/sdpdffilter.cxx +++ b/sd/source/filter/pdf/sdpdffilter.cxx @@ -77,12 +77,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; + pSdrGrafObj->SetResizeProtect(true); pSdrGrafObj->SetMoveProtect(true); |