From bf4aa2cc93a67826247e887b2ba26a1b965eb616 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Tue, 19 May 2015 14:56:52 -0700 Subject: Revert "Remove FX_Alloc() null checks now that it can't return NULL." This reverts commit eb6527763171cdb4b0fbfea5a20d691f4d67b660. Reason for revert: broke javascript tests. TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/1145843005 --- core/src/fpdfdoc/doc_annot.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'core/src/fpdfdoc/doc_annot.cpp') diff --git a/core/src/fpdfdoc/doc_annot.cpp b/core/src/fpdfdoc/doc_annot.cpp index 0ddcb2305e..4ccce21f1c 100644 --- a/core/src/fpdfdoc/doc_annot.cpp +++ b/core/src/fpdfdoc/doc_annot.cpp @@ -339,6 +339,9 @@ CPDF_PageObject* CPDF_Annot::GetBorder(FX_BOOL bPrint, const CPDF_RenderOptions* dash_count ++; } pGraphState->m_DashArray = FX_Alloc(FX_FLOAT, dash_count); + if (pGraphState->m_DashArray == NULL) { + return NULL; + } pGraphState->m_DashCount = dash_count; FX_DWORD i; for (i = 0; i < pDashArray->GetCount(); i ++) { @@ -349,6 +352,9 @@ CPDF_PageObject* CPDF_Annot::GetBorder(FX_BOOL bPrint, const CPDF_RenderOptions* } } else { pGraphState->m_DashArray = FX_Alloc(FX_FLOAT, 2); + if (pGraphState->m_DashArray == NULL) { + return NULL; + } pGraphState->m_DashCount = 2; pGraphState->m_DashArray[0] = pGraphState->m_DashArray[1] = 3 * 1.0f; } @@ -435,6 +441,9 @@ void CPDF_Annot::DrawBorder(CFX_RenderDevice* pDevice, const CFX_AffineMatrix* p dash_count ++; } graph_state.m_DashArray = FX_Alloc(FX_FLOAT, dash_count); + if (graph_state.m_DashArray == NULL) { + return ; + } graph_state.m_DashCount = dash_count; FX_DWORD i; for (i = 0; i < pDashArray->GetCount(); i ++) { @@ -445,6 +454,9 @@ void CPDF_Annot::DrawBorder(CFX_RenderDevice* pDevice, const CFX_AffineMatrix* p } } else { graph_state.m_DashArray = FX_Alloc(FX_FLOAT, 2); + if (graph_state.m_DashArray == NULL) { + return ; + } graph_state.m_DashCount = 2; graph_state.m_DashArray[0] = graph_state.m_DashArray[1] = 3 * 1.0f; } -- cgit v1.2.3