summaryrefslogtreecommitdiff
path: root/core/fpdfapi
diff options
context:
space:
mode:
authortsepez <tsepez@chromium.org>2016-09-22 11:37:13 -0700
committerCommit bot <commit-bot@chromium.org>2016-09-22 11:37:13 -0700
commitfef62e1f2bbf064100e6e262a10653f2374bfd2b (patch)
tree5532d2a9d2fd82a1c9ccdfc9141b65af60897313 /core/fpdfapi
parent8e0638b1531493e2d5fe3a603f4be60418c78bc4 (diff)
downloadpdfium-fef62e1f2bbf064100e6e262a10653f2374bfd2b.tar.xz
Null CPDF_CountedObj::m_pObj prior to deletion
This gives additional protection in case of re-entry. Also make CFX_CountRef more robust in face of errors. BUG=649229 Review-Url: https://codereview.chromium.org/2364673002
Diffstat (limited to 'core/fpdfapi')
-rw-r--r--core/fpdfapi/fpdf_page/cpdf_countedobject.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/core/fpdfapi/fpdf_page/cpdf_countedobject.h b/core/fpdfapi/fpdf_page/cpdf_countedobject.h
index e7f4ab6af0..c61e024589 100644
--- a/core/fpdfapi/fpdf_page/cpdf_countedobject.h
+++ b/core/fpdfapi/fpdf_page/cpdf_countedobject.h
@@ -20,8 +20,10 @@ class CPDF_CountedObject {
m_pObj = ptr;
}
void clear() { // Now you're all weak ptrs ...
- delete m_pObj;
+ // Guard against accidental re-entry.
+ T* pObj = m_pObj;
m_pObj = nullptr;
+ delete pObj;
}
T* get() const { return m_pObj; }
T* AddRef() {