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

New commits:
commit 8e5886ad0993a360f24a83de9bc2645271e92185
Author:     Miklos Vajna <vmik...@collabora.com>
AuthorDate: Mon Aug 1 09:31:48 2022 +0200
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Mon Aug 8 23:16:29 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
    (cherry picked from commit 60f9ca81e84f1bede4928c6f680325692cc8bc49)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137965
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>
    (cherry picked from commit f37998fdc3044ce8d477c2cfb0b9219d5f8ba75d)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137969

diff --git a/vcl/source/filter/ipdf/pdfread.cxx 
b/vcl/source/filter/ipdf/pdfread.cxx
index a69d10c7cafc..90d195acf752 100644
--- a/vcl/source/filter/ipdf/pdfread.cxx
+++ b/vcl/source/filter/ipdf/pdfread.cxx
@@ -252,6 +252,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