Fix SEGV when CPDFSDK_PageView contains an XFA Annot.
Apply the same check as in line 194 but in the opposite direction
to cover non-XFA requests. Crash avoided in chrome at the moment
unless XFA is explicitly finched on.
Bug: chromium:1180493
Change-Id: I6ad14d21889003699569a6ad87a3409a6e2409cf
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/78270
Reviewed-by: Hui Yingst <nigi@chromium.org>
Reviewed-by: Daniel Hosseinian <dhoss@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/fpdfsdk/cpdfsdk_pageview.cpp b/fpdfsdk/cpdfsdk_pageview.cpp
index 4b6705d..75719fa 100644
--- a/fpdfsdk/cpdfsdk_pageview.cpp
+++ b/fpdfsdk/cpdfsdk_pageview.cpp
@@ -177,7 +177,8 @@
CPDFSDK_Annot* CPDFSDK_PageView::GetAnnotByDict(CPDF_Dictionary* pDict) {
for (CPDFSDK_Annot* pAnnot : m_SDKAnnotArray) {
- if (pAnnot->GetPDFAnnot()->GetAnnotDict() == pDict)
+ CPDF_Annot* pPDFAnnot = pAnnot->GetPDFAnnot();
+ if (pPDFAnnot && pPDFAnnot->GetAnnotDict() == pDict)
return pAnnot;
}
return nullptr;