From 190645c34266d7e8ed2a3026d11a7fd5a03de86a Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Wed, 17 Oct 2018 04:12:44 +0000 Subject: Fix assert failure in CPDF_InteractiveForm::GetControlsForField(). |CPDF_InteractiveForm::m_ControlLists| replaced |CPDF_FormField::m_ControlList| for all CPDF_FormFields. So when any CPDF_FormFields wants to know about its control list, it has to ask CPDF_InteractiveForm. Every CPDF_FormField started out with an empty control list, so CPDF_InteractiveForm should keep that behavior. BUG=chromium:895983 TBR=tsepez@chromium.org Change-Id: Ibae5f6f54a21b9576b253e230c346bfd6705ca5d Reviewed-on: https://pdfium-review.googlesource.com/c/44150 Reviewed-by: Lei Zhang Commit-Queue: Lei Zhang --- core/fpdfdoc/cpdf_interactiveform.cpp | 6 ++---- core/fpdfdoc/cpdf_interactiveform.h | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/core/fpdfdoc/cpdf_interactiveform.cpp b/core/fpdfdoc/cpdf_interactiveform.cpp index 754737c454..403344c0ff 100644 --- a/core/fpdfdoc/cpdf_interactiveform.cpp +++ b/core/fpdfdoc/cpdf_interactiveform.cpp @@ -827,10 +827,8 @@ void CPDF_InteractiveForm::ResetForm(NotificationOption notify) { } const std::vector>& -CPDF_InteractiveForm::GetControlsForField(const CPDF_FormField* pField) const { - const auto& it = m_ControlLists.find(pField); - ASSERT(it != m_ControlLists.end()); - return it->second; +CPDF_InteractiveForm::GetControlsForField(const CPDF_FormField* pField) { + return m_ControlLists[pField]; } void CPDF_InteractiveForm::LoadField(CPDF_Dictionary* pFieldDict, int nLevel) { diff --git a/core/fpdfdoc/cpdf_interactiveform.h b/core/fpdfdoc/cpdf_interactiveform.h index 7a89320692..49335e99c0 100644 --- a/core/fpdfdoc/cpdf_interactiveform.h +++ b/core/fpdfdoc/cpdf_interactiveform.h @@ -92,7 +92,7 @@ class CPDF_InteractiveForm { CPDF_Dictionary* GetFormDict() const { return m_pFormDict.Get(); } const std::vector>& GetControlsForField( - const CPDF_FormField* pField) const; + const CPDF_FormField* pField); private: void LoadField(CPDF_Dictionary* pFieldDict, int nLevel); -- cgit v1.2.3