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

Unified Diff: core/fpdfapi/fpdf_parser/cpdf_dictionary.cpp

Issue 1888333002: Prevent cloned arrays/dictionaries from having nullptrs. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: Created 4 years, 8 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
« no previous file with comments | « core/fpdfapi/fpdf_parser/cpdf_array.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/fpdfapi/fpdf_parser/cpdf_dictionary.cpp
diff --git a/core/fpdfapi/fpdf_parser/cpdf_dictionary.cpp b/core/fpdfapi/fpdf_parser/cpdf_dictionary.cpp
index 27b866a65b52010ba06179754904013faec75448..8e4b282ef96a4a52e2d628f3ff8a7c0c84b19767 100644
--- a/core/fpdfapi/fpdf_parser/cpdf_dictionary.cpp
+++ b/core/fpdfapi/fpdf_parser/cpdf_dictionary.cpp
@@ -46,8 +46,11 @@ const CPDF_Dictionary* CPDF_Dictionary::AsDictionary() const {
CPDF_Object* CPDF_Dictionary::Clone(FX_BOOL bDirect) const {
CPDF_Dictionary* pCopy = new CPDF_Dictionary();
- for (const auto& it : *this)
- pCopy->m_Map.insert(std::make_pair(it.first, it.second->Clone(bDirect)));
+ for (const auto& it : *this) {
+ CPDF_Object* pClonedObj = it.second->Clone(bDirect);
+ if (pClonedObj)
+ pCopy->m_Map.insert(std::make_pair(it.first, pClonedObj));
+ }
return pCopy;
}
« no previous file with comments | « core/fpdfapi/fpdf_parser/cpdf_array.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698