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.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/core/fxcodec/jbig2/JBig2_GrrdProc.cpp b/core/fxcodec/jbig2/JBig2_GrrdProc.cpp
index fa4d435a92..8e4d8c005b 100644
--- a/core/fxcodec/jbig2/JBig2_GrrdProc.cpp
+++ b/core/fxcodec/jbig2/JBig2_GrrdProc.cpp
@@ -37,9 +37,12 @@ std::unique_ptr<CJBig2_Image> CJBig2_GRRDProc::Decode(
std::unique_ptr<CJBig2_Image> CJBig2_GRRDProc::DecodeTemplate0Unopt(
CJBig2_ArithDecoder* pArithDecoder,
JBig2ArithCtx* grContext) {
- int LTP = 0;
auto GRREG = pdfium::MakeUnique<CJBig2_Image>(GRW, GRH);
+ if (!GRREG->data())
+ return nullptr;
+
GRREG->fill(0);
+ int LTP = 0;
for (uint32_t h = 0; h < GRH; h++) {
if (TPGRON) {
if (pArithDecoder->IsComplete())
@@ -278,9 +281,12 @@ std::unique_ptr<CJBig2_Image> CJBig2_GRRDProc::DecodeTemplate0Opt(
std::unique_ptr<CJBig2_Image> CJBig2_GRRDProc::DecodeTemplate1Unopt(
CJBig2_ArithDecoder* pArithDecoder,
JBig2ArithCtx* grContext) {
- int LTP = 0;
auto GRREG = pdfium::MakeUnique<CJBig2_Image>(GRW, GRH);
+ if (!GRREG->data())
+ return nullptr;
+
GRREG->fill(0);
+ int LTP = 0;
for (uint32_t h = 0; h < GRH; h++) {
if (TPGRON) {
if (pArithDecoder->IsComplete())