summaryrefslogtreecommitdiff
path: root/core/fxcodec/jbig2/JBig2_GrrdProc.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/fxcodec/jbig2/JBig2_GrrdProc.cpp')
-rw-r--r--core/fxcodec/jbig2/JBig2_GrrdProc.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/core/fxcodec/jbig2/JBig2_GrrdProc.cpp b/core/fxcodec/jbig2/JBig2_GrrdProc.cpp
index 11fa39945d..049e50a1a9 100644
--- a/core/fxcodec/jbig2/JBig2_GrrdProc.cpp
+++ b/core/fxcodec/jbig2/JBig2_GrrdProc.cpp
@@ -16,8 +16,10 @@
std::unique_ptr<CJBig2_Image> CJBig2_GRRDProc::decode(
CJBig2_ArithDecoder* pArithDecoder,
JBig2ArithCtx* grContext) {
- if (GRW == 0 || GRH == 0)
+ if (GRW == 0 || GRW > JBIG2_MAX_IMAGE_SIZE || GRH == 0 ||
+ GRH > JBIG2_MAX_IMAGE_SIZE) {
return pdfium::MakeUnique<CJBig2_Image>(GRW, GRH);
+ }
if (!GRTEMPLATE) {
if ((GRAT[0] == -1) && (GRAT[1] == -1) && (GRAT[2] == -1) &&