summaryrefslogtreecommitdiff
path: root/core/fxcodec/jbig2/JBig2_ArithDecoder.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/fxcodec/jbig2/JBig2_ArithDecoder.cpp')
-rw-r--r--core/fxcodec/jbig2/JBig2_ArithDecoder.cpp6
1 files 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;