summaryrefslogtreecommitdiff
path: root/core/fxcodec/jbig2/JBig2_GrdProc.cpp
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2018-04-27 16:54:28 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-04-27 16:54:28 +0000
commit61f66c9be2abf4f2a5f8bc299ad6e1900c63dbc3 (patch)
tree4dc0116df63dce8414b8c08c272e5d0878ed8f03 /core/fxcodec/jbig2/JBig2_GrdProc.cpp
parent0e3635c59e79e8ca782412fa1bcf377c7c4f980e (diff)
downloadpdfium-61f66c9be2abf4f2a5f8bc299ad6e1900c63dbc3.tar.xz
Add CJBig2_Image::IsValidImageSize() helper method.
Change-Id: Ic2acd6f03b9b2e52b3d94d7579d5dc36c8e62c96 Reviewed-on: https://pdfium-review.googlesource.com/31530 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Diffstat (limited to 'core/fxcodec/jbig2/JBig2_GrdProc.cpp')
-rw-r--r--core/fxcodec/jbig2/JBig2_GrdProc.cpp7
1 files changed, 2 insertions, 5 deletions
diff --git a/core/fxcodec/jbig2/JBig2_GrdProc.cpp b/core/fxcodec/jbig2/JBig2_GrdProc.cpp
index faa4865bc4..55c6bb9a97 100644
--- a/core/fxcodec/jbig2/JBig2_GrdProc.cpp
+++ b/core/fxcodec/jbig2/JBig2_GrdProc.cpp
@@ -46,10 +46,8 @@ bool CJBig2_GRDProc::UseTemplate23Opt3() const {
std::unique_ptr<CJBig2_Image> CJBig2_GRDProc::decode_Arith(
CJBig2_ArithDecoder* pArithDecoder,
JBig2ArithCtx* gbContext) {
- if (GBW == 0 || GBW > JBIG2_MAX_IMAGE_SIZE || GBH == 0 ||
- GBH > JBIG2_MAX_IMAGE_SIZE) {
+ if (!CJBig2_Image::IsValidImageSize(GBW, GBH))
return pdfium::MakeUnique<CJBig2_Image>(GBW, GBH);
- }
if (GBTEMPLATE == 0) {
if (UseTemplate0Opt3())
@@ -642,8 +640,7 @@ FXCODEC_STATUS CJBig2_GRDProc::Start_decode_Arith(
CJBig2_ArithDecoder* pArithDecoder,
JBig2ArithCtx* gbContext,
PauseIndicatorIface* pPause) {
- if (GBW == 0 || GBW > JBIG2_MAX_IMAGE_SIZE || GBH == 0 ||
- GBH > JBIG2_MAX_IMAGE_SIZE) {
+ if (!CJBig2_Image::IsValidImageSize(GBW, GBH)) {
m_ProssiveStatus = FXCODEC_STATUS_DECODE_FINISH;
return FXCODEC_STATUS_DECODE_FINISH;
}