diff options
author | Oliver Chang <ochang@chromium.org> | 2016-01-13 18:32:12 -0800 |
---|---|---|
committer | Oliver Chang <ochang@chromium.org> | 2016-01-13 18:32:12 -0800 |
commit | cae57daaa0f7ed4c92e22c4e7ef30392393d1128 (patch) | |
tree | ea52784c8837d807145e7c6c985dc559b69c9348 /fpdfsdk | |
parent | 5d1070dc642800242ec2e9d9d74aa1e5715d2b62 (diff) | |
download | pdfium-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')
-rw-r--r-- | fpdfsdk/src/fpdfppo.cpp | 8 |
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; |