summaryrefslogtreecommitdiff
path: root/fpdfsdk/src/fpdfppo.cpp
diff options
context:
space:
mode:
authorOliver Chang <ochang@chromium.org>2016-01-13 18:32:12 -0800
committerOliver Chang <ochang@chromium.org>2016-01-13 18:32:12 -0800
commitcae57daaa0f7ed4c92e22c4e7ef30392393d1128 (patch)
treeea52784c8837d807145e7c6c985dc559b69c9348 /fpdfsdk/src/fpdfppo.cpp
parent5d1070dc642800242ec2e9d9d74aa1e5715d2b62 (diff)
downloadpdfium-cae57daaa0f7ed4c92e22c4e7ef30392393d1128.tar.xz
Fix some iterator invalidation issues while traversing CPDF_Dictionary.
Also fixes a potential issue in CPDF_Dictionary::ReplaceKey. R=thestig@chromium.org BUG=577030 Review URL: https://codereview.chromium.org/1582963003 .
Diffstat (limited to 'fpdfsdk/src/fpdfppo.cpp')
-rw-r--r--fpdfsdk/src/fpdfppo.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/fpdfsdk/src/fpdfppo.cpp b/fpdfsdk/src/fpdfppo.cpp
index dac548131e..47b91015a9 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()) {
+ const CFX_ByteString& key = it->first;
+ CPDF_Object* pNextObj = it->second;
+ ++it;
if (!FXSYS_strcmp(key, "Parent") || !FXSYS_strcmp(key, "Prev") ||
!FXSYS_strcmp(key, "First")) {
continue;