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

Unified Diff: fpdfsdk/src/fpdfppo.cpp

Issue 1582963003: Fix some iterator invalidation issues while traversing CPDF_Dictionary. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: fix a bug in CPDF_Dictionary::ReplaceKey while we're at it Created 4 years, 11 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
Index: fpdfsdk/src/fpdfppo.cpp
diff --git a/fpdfsdk/src/fpdfppo.cpp b/fpdfsdk/src/fpdfppo.cpp
index dac548131e7596292bf3e3f795231718d0e08b0a..b98025e1bd543ee729d4d0ae8e30640155712bea 100644
--- a/fpdfsdk/src/fpdfppo.cpp
+++ b/fpdfsdk/src/fpdfppo.cpp
@@ -213,9 +213,11 @@ FX_BOOL CPDF_PageOrganizer::UpdateReference(CPDF_Object* pObj,
}
case PDFOBJ_DICTIONARY: {
CPDF_Dictionary* pDict = pObj->AsDictionary();
- for (const auto& it : *pDict) {
- const CFX_ByteString& key = it.first;
- CPDF_Object* pNextObj = it.second;
+ auto it = pDict->begin();
+ while (it != pDict->end()) {
+ auto old_it = it++;
+ const CFX_ByteString& key = old_it->first;
+ CPDF_Object* pNextObj = old_it->second;
if (!FXSYS_strcmp(key, "Parent") || !FXSYS_strcmp(key, "Prev") ||
!FXSYS_strcmp(key, "First")) {
continue;

Powered by Google App Engine
This is Rietveld 408576698