diff options
author | Lei Zhang <thestig@chromium.org> | 2018-05-04 18:49:57 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-05-04 18:49:57 +0000 |
commit | 36b3d19281e2911a97d6ce84538a3ae575ac38a7 (patch) | |
tree | 9695f3a5d67dc08c993a844adbda086b480f275a /core/fxcodec/jbig2/JBig2_GrrdProc.cpp | |
parent | ad178855775da18d7abfadce4b64825f3e32adbd (diff) | |
download | pdfium-36b3d19281e2911a97d6ce84538a3ae575ac38a7.tar.xz |
Check CJBig2_Image is valid before filling.chromium/3423chromium/3422chromium/3421
Skip a lot of work that will all fail anyway.
BUG=chromium:838347
Change-Id: Iba45120e436b5547e106feb27dadea92cc948258
Reviewed-on: https://pdfium-review.googlesource.com/32053
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Diffstat (limited to 'core/fxcodec/jbig2/JBig2_GrrdProc.cpp')
-rw-r--r-- | core/fxcodec/jbig2/JBig2_GrrdProc.cpp | 10 |
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()) |