summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorthestig <thestig@chromium.org>2016-08-16 17:02:48 -0700
committerCommit bot <commit-bot@chromium.org>2016-08-16 17:02:48 -0700
commit4674d957a7637da9d242ff1bdba73a078f99a171 (patch)
treef3b3cda7a7e2e40788a3110c39ff98a870e2ad4d
parentb88b8e47fd7adc14c7aff048c0def0579bdd22dd (diff)
downloadpdfium-chromium/2832.tar.xz
Fix a double free in CPDFSDK_PageView::IsValidAnnot().chromium/2832
BUG=635848 Review-Url: https://codereview.chromium.org/2242213004
-rw-r--r--fpdfsdk/fsdk_mgr.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/fpdfsdk/fsdk_mgr.cpp b/fpdfsdk/fsdk_mgr.cpp
index f7fdae6dd8..144bea4bc8 100644
--- a/fpdfsdk/fsdk_mgr.cpp
+++ b/fpdfsdk/fsdk_mgr.cpp
@@ -1033,8 +1033,11 @@ bool CPDFSDK_PageView::IsValidAnnot(const CPDF_Annot* p) const {
return false;
const auto& annots = m_pAnnotList->All();
- std::unique_ptr<const CPDF_Annot> annot(p);
- return pdfium::ContainsValue(annots, annot);
+ auto it = std::find_if(annots.begin(), annots.end(),
+ [p](const std::unique_ptr<CPDF_Annot>& annot) {
+ return annot.get() == p;
+ });
+ return it != annots.end();
}
CPDFSDK_Annot* CPDFSDK_PageView::GetFocusAnnot() {