summaryrefslogtreecommitdiff
path: root/core/fxcodec/jbig2/JBig2_GrdProc.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2017-05-26 12:21:14 -0700
committerChromium commit bot <commit-bot@chromium.org>2017-05-26 20:35:00 +0000
commitcdfc035f4ea2e786c7d7820e143c18bdb11fac3f (patch)
tree7ee209e5b3c55f2ce87f5d02d6f5d6fb4058a013 /core/fxcodec/jbig2/JBig2_GrdProc.cpp
parentfb9c11b49ee4fe6c18703d661dcaee498085c4c5 (diff)
downloadpdfium-cdfc035f4ea2e786c7d7820e143c18bdb11fac3f.tar.xz
Pass CJBig2_ArithDecoder to CJBig2_GRDProc as needed.
Avoid holding a stale pointer to it in CJBig2_GRDProc. Bug: 726732 Change-Id: Ia3797a3e087f61bd2126f867fd5a282e873de5bc Reviewed-on: https://pdfium-review.googlesource.com/6050 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'core/fxcodec/jbig2/JBig2_GrdProc.cpp')
-rw-r--r--core/fxcodec/jbig2/JBig2_GrdProc.cpp50
1 files changed, 26 insertions, 24 deletions
diff --git a/core/fxcodec/jbig2/JBig2_GrdProc.cpp b/core/fxcodec/jbig2/JBig2_GrdProc.cpp
index a8140bdd24..c63a40dc33 100644
--- a/core/fxcodec/jbig2/JBig2_GrdProc.cpp
+++ b/core/fxcodec/jbig2/JBig2_GrdProc.cpp
@@ -652,57 +652,58 @@ FXCODEC_STATUS CJBig2_GRDProc::Start_decode_Arith(
m_DecodeType = 1;
m_pImage = pImage;
(*m_pImage)->fill(0);
- m_pArithDecoder = pArithDecoder;
m_gbContext = gbContext;
m_LTP = 0;
m_pLine = nullptr;
m_loopIndex = 0;
- return decode_Arith(pPause);
+ return decode_Arith(pPause, pArithDecoder);
}
-FXCODEC_STATUS CJBig2_GRDProc::decode_Arith(IFX_Pause* pPause) {
+FXCODEC_STATUS CJBig2_GRDProc::decode_Arith(
+ IFX_Pause* pPause,
+ CJBig2_ArithDecoder* pArithDecoder) {
int iline = m_loopIndex;
CJBig2_Image* pImage = *m_pImage;
if (GBTEMPLATE == 0) {
if (UseTemplate0Opt3()) {
- m_ProssiveStatus = decode_Arith_Template0_opt3(
- pImage, m_pArithDecoder.Get(), m_gbContext, pPause);
+ m_ProssiveStatus = decode_Arith_Template0_opt3(pImage, pArithDecoder,
+ m_gbContext, pPause);
} else {
- m_ProssiveStatus = decode_Arith_Template0_unopt(
- pImage, m_pArithDecoder.Get(), m_gbContext, pPause);
+ m_ProssiveStatus = decode_Arith_Template0_unopt(pImage, pArithDecoder,
+ m_gbContext, pPause);
}
} else if (GBTEMPLATE == 1) {
if (UseTemplate1Opt3()) {
- m_ProssiveStatus = decode_Arith_Template1_opt3(
- pImage, m_pArithDecoder.Get(), m_gbContext, pPause);
+ m_ProssiveStatus = decode_Arith_Template1_opt3(pImage, pArithDecoder,
+ m_gbContext, pPause);
} else {
- m_ProssiveStatus = decode_Arith_Template1_unopt(
- pImage, m_pArithDecoder.Get(), m_gbContext, pPause);
+ m_ProssiveStatus = decode_Arith_Template1_unopt(pImage, pArithDecoder,
+ m_gbContext, pPause);
}
} else if (GBTEMPLATE == 2) {
if (UseTemplate23Opt3()) {
- m_ProssiveStatus = decode_Arith_Template2_opt3(
- pImage, m_pArithDecoder.Get(), m_gbContext, pPause);
+ m_ProssiveStatus = decode_Arith_Template2_opt3(pImage, pArithDecoder,
+ m_gbContext, pPause);
} else {
- m_ProssiveStatus = decode_Arith_Template2_unopt(
- pImage, m_pArithDecoder.Get(), m_gbContext, pPause);
+ m_ProssiveStatus = decode_Arith_Template2_unopt(pImage, pArithDecoder,
+ m_gbContext, pPause);
}
} else {
if (UseTemplate23Opt3()) {
- m_ProssiveStatus = decode_Arith_Template3_opt3(
- pImage, m_pArithDecoder.Get(), m_gbContext, pPause);
+ m_ProssiveStatus = decode_Arith_Template3_opt3(pImage, pArithDecoder,
+ m_gbContext, pPause);
} else {
- m_ProssiveStatus = decode_Arith_Template3_unopt(
- pImage, m_pArithDecoder.Get(), m_gbContext, pPause);
+ m_ProssiveStatus = decode_Arith_Template3_unopt(pImage, pArithDecoder,
+ m_gbContext, pPause);
}
}
m_ReplaceRect.left = 0;
m_ReplaceRect.right = pImage->width();
m_ReplaceRect.top = iline;
m_ReplaceRect.bottom = m_loopIndex;
- if (m_ProssiveStatus == FXCODEC_STATUS_DECODE_FINISH) {
+ if (m_ProssiveStatus == FXCODEC_STATUS_DECODE_FINISH)
m_loopIndex = 0;
- }
+
return m_ProssiveStatus;
}
@@ -727,7 +728,9 @@ FXCODEC_STATUS CJBig2_GRDProc::Start_decode_MMR(CJBig2_Image** pImage,
return m_ProssiveStatus;
}
-FXCODEC_STATUS CJBig2_GRDProc::Continue_decode(IFX_Pause* pPause) {
+FXCODEC_STATUS CJBig2_GRDProc::Continue_decode(
+ IFX_Pause* pPause,
+ CJBig2_ArithDecoder* pArithDecoder) {
if (m_ProssiveStatus != FXCODEC_STATUS_DECODE_TOBECONTINUE)
return m_ProssiveStatus;
@@ -735,8 +738,7 @@ FXCODEC_STATUS CJBig2_GRDProc::Continue_decode(IFX_Pause* pPause) {
m_ProssiveStatus = FXCODEC_STATUS_ERROR;
return m_ProssiveStatus;
}
-
- return decode_Arith(pPause);
+ return decode_Arith(pPause, pArithDecoder);
}
FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template0_opt3(