vcl/source/filter/ipdf/pdfread.cxx |    5 +++++
 1 file changed, 5 insertions(+)

New commits:
commit 60f9ca81e84f1bede4928c6f680325692cc8bc49
Author:     Miklos Vajna <vmik...@collabora.com>
AuthorDate: Mon Aug 1 09:31:48 2022 +0200
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Mon Aug 1 14:17:35 2022 +0200

    vcl: fix crash in vcl::ImportPDFUnloaded()
    
    Crashreport signature:
    
    SIG   Fatal signal received: SIGSEGV code: 1 for address: 0x0
    program/libmergedlo.so
            vcl::ImportPDFUnloaded(rtl::OUString const&, 
std::vector<vcl::PDFGraphicResult, std::allocator<vcl::PDFGraphicResult> >&)
                    vcl/source/filter/ipdf/pdfread.cxx:256
    program/../program/libsdlo.so
            SdPdfFilter::Import()
                    sd/source/filter/pdf/sdpdffilter.cxx:55
    program/../program/libsdlo.so
            sd::DrawDocShell::ConvertFrom(SfxMedium&)
                    sd/source/ui/docshell/docshel4.cxx:500 (discriminator 1)
    program/libmergedlo.so
            SfxObjectShell::DoLoad(SfxMedium*)
                    sfx2/source/doc/objstor.cxx:768
    
    Change-Id: I2fc635de696643af6a80a29aa5af4fa128f8776c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137673
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>
    Tested-by: Jenkins

diff --git a/vcl/source/filter/ipdf/pdfread.cxx 
b/vcl/source/filter/ipdf/pdfread.cxx
index 8510b0a0c207..e99682e0c0e4 100644
--- a/vcl/source/filter/ipdf/pdfread.cxx
+++ b/vcl/source/filter/ipdf/pdfread.cxx
@@ -258,6 +258,11 @@ std::vector<PDFGraphicAnnotation>
 findAnnotations(const std::unique_ptr<vcl::pdf::PDFiumPage>& pPage, 
basegfx::B2DSize aPageSize)
 {
     std::vector<PDFGraphicAnnotation> aPDFGraphicAnnotations;
+    if (!pPage)
+    {
+        return aPDFGraphicAnnotations;
+    }
+
     for (int nAnnotation = 0; nAnnotation < pPage->getAnnotationCount(); 
nAnnotation++)
     {
         auto pAnnotation = pPage->getAnnotation(nAnnotation);

Reply via email to