summaryrefslogtreecommitdiff
path: root/core/fxcodec/jbig2/JBig2_ArithDecoder.cpp
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2018-09-17 19:23:30 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-09-17 19:23:30 +0000
commitc37e9dff7c51c904c40d3a748cfcde90a2c02976 (patch)
tree924e4e23820551a2ed0161aad3a54fbace4c7bf5 /core/fxcodec/jbig2/JBig2_ArithDecoder.cpp
parenta828c6a9af31ccdb52189f819cd82b2f53bef38d (diff)
downloadpdfium-c37e9dff7c51c904c40d3a748cfcde90a2c02976.tar.xz
Remove a check that is never true in CJBig2_ArithDecoder::Decode().chromium/3555
Change-Id: I538fd8bf9905be61d2297181bd02a243a01b30db Reviewed-on: https://pdfium-review.googlesource.com/42607 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
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;