From c37e9dff7c51c904c40d3a748cfcde90a2c02976 Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Mon, 17 Sep 2018 19:23:30 +0000 Subject: Remove a check that is never true in CJBig2_ArithDecoder::Decode(). Change-Id: I538fd8bf9905be61d2297181bd02a243a01b30db Reviewed-on: https://pdfium-review.googlesource.com/42607 Commit-Queue: Lei Zhang Reviewed-by: Ryan Harrison --- core/fxcodec/jbig2/JBig2_ArithDecoder.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/core/fxcodec/jbig2/JBig2_ArithDecoder.cpp b/core/fxcodec/jbig2/JBig2_ArithDecoder.cpp index 0e9304af6f..45cca11eb8 100644 --- a/core/fxcodec/jbig2/JBig2_ArithDecoder.cpp +++ b/core/fxcodec/jbig2/JBig2_ArithDecoder.cpp @@ -41,11 +41,13 @@ int JBig2ArithCtx::DecodeNLPS(const JBig2ArithQe& qe) { if (qe.bSwitch) m_MPS = !m_MPS; m_I = qe.NLPS; + ASSERT(m_I < FX_ArraySize(kQeTable)); return D; } int JBig2ArithCtx::DecodeNMPS(const JBig2ArithQe& qe) { m_I = qe.NMPS; + ASSERT(m_I < FX_ArraySize(kQeTable)); return MPS(); } @@ -62,8 +64,8 @@ CJBig2_ArithDecoder::CJBig2_ArithDecoder(CJBig2_BitStream* pStream) CJBig2_ArithDecoder::~CJBig2_ArithDecoder() {} int CJBig2_ArithDecoder::Decode(JBig2ArithCtx* pCX) { - if (!pCX || pCX->I() >= FX_ArraySize(kQeTable)) - return 0; + ASSERT(pCX); + ASSERT(pCX->I() < FX_ArraySize(kQeTable)); const JBig2ArithCtx::JBig2ArithQe& qe = kQeTable[pCX->I()]; m_A -= qe.Qe; -- cgit v1.2.3