summaryrefslogtreecommitdiff
path: root/core/fpdfapi/parser/cpdf_array.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/fpdfapi/parser/cpdf_array.cpp')
-rw-r--r--core/fpdfapi/parser/cpdf_array.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/core/fpdfapi/parser/cpdf_array.cpp b/core/fpdfapi/parser/cpdf_array.cpp
index bf8b51e604..f3c23f37be 100644
--- a/core/fpdfapi/parser/cpdf_array.cpp
+++ b/core/fpdfapi/parser/cpdf_array.cpp
@@ -57,8 +57,11 @@ std::unique_ptr<CPDF_Object> CPDF_Array::CloneNonCyclic(
pVisited->insert(this);
auto pCopy = pdfium::MakeUnique<CPDF_Array>();
for (const auto& pValue : m_Objects) {
- if (!pdfium::ContainsKey(*pVisited, pValue.get()))
- pCopy->m_Objects.push_back(pValue->CloneNonCyclic(bDirect, pVisited));
+ if (!pdfium::ContainsKey(*pVisited, pValue.get())) {
+ std::set<const CPDF_Object*> visited(*pVisited);
+ if (auto obj = pValue->CloneNonCyclic(bDirect, &visited))
+ pCopy->m_Objects.push_back(std::move(obj));
+ }
}
return std::move(pCopy);
}