summaryrefslogtreecommitdiff
path: root/core/fpdfapi/page/cpdf_streamcontentparser.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/fpdfapi/page/cpdf_streamcontentparser.cpp')
-rw-r--r--core/fpdfapi/page/cpdf_streamcontentparser.cpp51
1 files changed, 27 insertions, 24 deletions
diff --git a/core/fpdfapi/page/cpdf_streamcontentparser.cpp b/core/fpdfapi/page/cpdf_streamcontentparser.cpp
index 79fa3d2890..beba208739 100644
--- a/core/fpdfapi/page/cpdf_streamcontentparser.cpp
+++ b/core/fpdfapi/page/cpdf_streamcontentparser.cpp
@@ -174,36 +174,39 @@ ByteStringView FindFullName(const AbbrPair* table,
void ReplaceAbbr(CPDF_Object* pObj) {
switch (pObj->GetType()) {
case CPDF_Object::DICTIONARY: {
- CPDF_Dictionary* pDict = pObj->AsDictionary();
std::vector<AbbrReplacementOp> replacements;
- for (const auto& it : *pDict) {
- ByteString key = it.first;
- CPDF_Object* value = it.second.get();
- ByteStringView fullname = FindFullName(
- InlineKeyAbbr, FX_ArraySize(InlineKeyAbbr), key.AsStringView());
- if (!fullname.IsEmpty()) {
- AbbrReplacementOp op;
- op.is_replace_key = true;
- op.key = std::move(key);
- op.replacement = fullname;
- replacements.push_back(op);
- key = fullname;
- }
-
- if (value->IsName()) {
- ByteString name = value->GetString();
- fullname =
- FindFullName(InlineValueAbbr, FX_ArraySize(InlineValueAbbr),
- name.AsStringView());
+ CPDF_Dictionary* pDict = pObj->AsDictionary();
+ {
+ CPDF_DictionaryLocker locker(pDict);
+ for (const auto& it : locker) {
+ ByteString key = it.first;
+ CPDF_Object* value = it.second.get();
+ ByteStringView fullname = FindFullName(
+ InlineKeyAbbr, FX_ArraySize(InlineKeyAbbr), key.AsStringView());
if (!fullname.IsEmpty()) {
AbbrReplacementOp op;
- op.is_replace_key = false;
- op.key = key;
+ op.is_replace_key = true;
+ op.key = std::move(key);
op.replacement = fullname;
replacements.push_back(op);
+ key = fullname;
+ }
+
+ if (value->IsName()) {
+ ByteString name = value->GetString();
+ fullname =
+ FindFullName(InlineValueAbbr, FX_ArraySize(InlineValueAbbr),
+ name.AsStringView());
+ if (!fullname.IsEmpty()) {
+ AbbrReplacementOp op;
+ op.is_replace_key = false;
+ op.key = key;
+ op.replacement = fullname;
+ replacements.push_back(op);
+ }
+ } else {
+ ReplaceAbbr(value);
}
- } else {
- ReplaceAbbr(value);
}
}
for (const auto& op : replacements) {