From 97b15bcc2d15dd754afbfbf8709fa62a9866160e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Szymon=20K=C5=82os?= Date: Mon, 25 Oct 2021 12:04:30 +0200 Subject: [PATCH] tdf#145312 xmlsecurity: prevent from crash when cannot receive pdfium annotation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I6adc2cb0a07eb08a50c610958983493f4f8031ee Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124021 Tested-by: Szymon Kłos Reviewed-by: Szymon Kłos --- xmlsecurity/source/helper/pdfsignaturehelper.cxx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/xmlsecurity/source/helper/pdfsignaturehelper.cxx b/xmlsecurity/source/helper/pdfsignaturehelper.cxx index 31740779de1c..95fca26f5945 100644 --- a/xmlsecurity/source/helper/pdfsignaturehelper.cxx +++ b/xmlsecurity/source/helper/pdfsignaturehelper.cxx @@ -275,6 +275,11 @@ void AnalyizeSignatureStream(SvMemoryStream& rStream, std::vector& for (int i = 0; i < pPdfPage->getAnnotationCount(); ++i) { std::unique_ptr pPdfAnnotation = pPdfPage->getAnnotation(i); + if (!pPdfAnnotation) + { + SAL_WARN("xmlsecurity.helper", "Cannot get PDFiumAnnotation"); + continue; + } vcl::pdf::PDFAnnotationSubType eType = pPdfAnnotation->getSubType(); switch (eType) {