summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVitaly Buka <vitalybuka@chromium.org>2015-07-10 15:40:59 -0700
committerVitaly Buka <vitalybuka@chromium.org>2015-07-10 15:40:59 -0700
commitaa575d4805bf7a9e83f00b56e38d4de39d90f95c (patch)
tree4330b53d7e9c5d78e2850e6b12ed26887e3810e0
parent07bb09f2ef02e310999b3c32a5eb287cfcd1c2d4 (diff)
downloadpdfium-aa575d4805bf7a9e83f00b56e38d4de39d90f95c.tar.xz
Make CJBig2_Object::operator delete accept nullptrchromium/2455
Standard delete operator should do noting for nullptr. Overloaded CJBig2_Object::operator delete de-referenced provided pointer causing crashes after https://codereview.chromium.org/1192743004/ TBR=thestig BUG=508197 Review URL: https://codereview.chromium.org/1230763007 .
-rw-r--r--core/src/fxcodec/jbig2/JBig2_Object.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/core/src/fxcodec/jbig2/JBig2_Object.cpp b/core/src/fxcodec/jbig2/JBig2_Object.cpp
index 1429a91644..ae544d72d5 100644
--- a/core/src/fxcodec/jbig2/JBig2_Object.cpp
+++ b/core/src/fxcodec/jbig2/JBig2_Object.cpp
@@ -1,7 +1,7 @@
// Copyright 2014 PDFium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-
+
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
#include "JBig2_Object.h"
@@ -26,7 +26,9 @@ void *CJBig2_Object::operator new(size_t size, CJBig2_Module *pModule)
}
void CJBig2_Object::operator delete(void *p)
{
- ((CJBig2_Object *)p)->m_pModule->JBig2_Free(p);
+ if (p) {
+ ((CJBig2_Object *)p)->m_pModule->JBig2_Free(p);
+ }
}
void CJBig2_Object::operator delete(void *p, CJBig2_Module *pModule)
{
@@ -64,7 +66,9 @@ void *CJBig2_Object::operator new[](size_t size, CJBig2_Module *pModule, size_t
}
void CJBig2_Object::operator delete[](void* p)
{
- ((CJBig2_Object *)p)->m_pModule->JBig2_Free(p);
+ if (p) {
+ ((CJBig2_Object *)p)->m_pModule->JBig2_Free(p);
+ }
}
void CJBig2_Object::operator delete[](void *p, CJBig2_Module *pModule, size_t unit_size)
{