diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2018-02-13 20:05:26 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-02-13 20:05:26 +0000 |
commit | d0a6f75ffd6a760c70771cc237b843b1ac2a94ee (patch) | |
tree | 87958707fb5e7657cfd1a1e6c0c217eb0ee1f7a3 /xfa/fxfa/parser/cxfa_node.cpp | |
parent | 1e364c42c16d1688eef4c1faa9d0929564cea04f (diff) | |
download | pdfium-d0a6f75ffd6a760c70771cc237b843b1ac2a94ee.tar.xz |
Convert ASSERT to PDFIUM_IMMEDIATE_CRASH
This CL changes the ASSERTs used in CXFA_Node::InsertChild and
RemoveChild to PDFIUM_IMMEDIATE_CRASH. The ASSERTs are compiled out in
Release mode, we want to make sure we don't accidentally build invalid
node trees in Release.
Change-Id: Ic96c8ab457631d1f32d36d7d12bd5888f1cf4b0a
Reviewed-on: https://pdfium-review.googlesource.com/26431
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'xfa/fxfa/parser/cxfa_node.cpp')
-rw-r--r-- | xfa/fxfa/parser/cxfa_node.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/xfa/fxfa/parser/cxfa_node.cpp b/xfa/fxfa/parser/cxfa_node.cpp index a895b855d0..83da3e76df 100644 --- a/xfa/fxfa/parser/cxfa_node.cpp +++ b/xfa/fxfa/parser/cxfa_node.cpp @@ -1112,8 +1112,10 @@ CXFA_Node* CXFA_Node::GetChildInternal(size_t index, } void CXFA_Node::InsertChild(int32_t index, CXFA_Node* pNode) { - ASSERT(pNode); - ASSERT(!pNode->parent_); + if (!pNode || pNode->parent_ != nullptr) { + PDFIUM_IMMEDIATE_CRASH(); + } + pNode->parent_ = this; pNode->ClearFlag(XFA_NodeFlag_HasRemovedChildren); @@ -1173,8 +1175,7 @@ void CXFA_Node::InsertChild(int32_t index, CXFA_Node* pNode) { void CXFA_Node::InsertChild(CXFA_Node* pNode, CXFA_Node* pBeforeNode) { if (pBeforeNode && pBeforeNode->parent_ != this) { - NOTREACHED(); - return; + PDFIUM_IMMEDIATE_CRASH(); } int32_t index = -1; @@ -1194,8 +1195,9 @@ void CXFA_Node::InsertChild(CXFA_Node* pNode, CXFA_Node* pBeforeNode) { } void CXFA_Node::RemoveChild(CXFA_Node* pNode, bool bNotify) { - ASSERT(pNode); - ASSERT(pNode->parent_ == this); + if (!pNode || pNode->parent_ != this) { + PDFIUM_IMMEDIATE_CRASH(); + } pNode->SetFlag(XFA_NodeFlag_HasRemovedChildren, true); |