From 22b176d0ee7f1dcbc7bca6e5eef65c19fa10f726 Mon Sep 17 00:00:00 2001 From: thestig Date: Thu, 25 Aug 2016 11:14:21 -0700 Subject: Check for nullptrs in CPDF_Dictionary dtor. BUG=597440 Review-Url: https://codereview.chromium.org/2273293003 --- core/fpdfapi/fpdf_parser/cpdf_dictionary.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to '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 8fef074d4b..e79bac1839 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_dictionary.cpp +++ b/core/fpdfapi/fpdf_parser/cpdf_dictionary.cpp @@ -6,6 +6,9 @@ #include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" +#include +#include + #include "core/fpdfapi/fpdf_parser/cpdf_boolean.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_name.h" @@ -18,9 +21,13 @@ CPDF_Dictionary::CPDF_Dictionary() {} CPDF_Dictionary::~CPDF_Dictionary() { + // Mark the object as deleted so that it will not be deleted again + // in case of cyclic references. m_ObjNum = kInvalidObjNum; - for (const auto& it : m_Map) - it.second->Release(); + for (const auto& it : m_Map) { + if (it.second) + it.second->Release(); + } } CPDF_Object::Type CPDF_Dictionary::GetType() const { -- cgit v1.2.3