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

Unified Diff: core/fpdfapi/fpdf_parser/cpdf_array.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 | « no previous file | core/fpdfapi/fpdf_parser/cpdf_dictionary.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/fpdfapi/fpdf_parser/cpdf_array.cpp
diff --git a/core/fpdfapi/fpdf_parser/cpdf_array.cpp b/core/fpdfapi/fpdf_parser/cpdf_array.cpp
index d588f339a7b45c09347e504b355dc8326025cb4a..efe0518d86d40166ae32927e31e02312ba7e1d4a 100644
--- a/core/fpdfapi/fpdf_parser/cpdf_array.cpp
+++ b/core/fpdfapi/fpdf_parser/cpdf_array.cpp
@@ -46,8 +46,10 @@ const CPDF_Array* CPDF_Array::AsArray() const {
CPDF_Object* CPDF_Array::Clone(FX_BOOL bDirect) const {
CPDF_Array* pCopy = new CPDF_Array();
for (size_t i = 0; i < GetCount(); i++) {
- CPDF_Object* value = m_Objects.at(i);
- pCopy->m_Objects.push_back(value->Clone(bDirect));
+ CPDF_Object* pObj = m_Objects.at(i);
+ CPDF_Object* pCloneObj = pObj->Clone(bDirect);
+ if (pCloneObj)
+ pCopy->m_Objects.push_back(pCloneObj);
}
return pCopy;
}
« no previous file with comments | « no previous file | core/fpdfapi/fpdf_parser/cpdf_dictionary.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698