Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(59)

Unified Diff: fpdfsdk/fsdk_mgr.cpp

Issue 2242213004: Fix a double free in CPDFSDK_PageView::IsValidAnnot(). (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fpdfsdk/fsdk_mgr.cpp
diff --git a/fpdfsdk/fsdk_mgr.cpp b/fpdfsdk/fsdk_mgr.cpp
index f7fdae6dd87f9c03bad4fb579f1066caeb1dd2c8..144bea4bc87eabb8c27d1b9c4354534045f5544a 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() {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698