summaryrefslogtreecommitdiff
path: root/core/fxcodec/jbig2/JBig2_HtrdProc.cpp
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2018-05-04 18:49:57 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-05-04 18:49:57 +0000
commit36b3d19281e2911a97d6ce84538a3ae575ac38a7 (patch)
tree9695f3a5d67dc08c993a844adbda086b480f275a /core/fxcodec/jbig2/JBig2_HtrdProc.cpp
parentad178855775da18d7abfadce4b64825f3e32adbd (diff)
downloadpdfium-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_HtrdProc.cpp')
-rw-r--r--core/fxcodec/jbig2/JBig2_HtrdProc.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/core/fxcodec/jbig2/JBig2_HtrdProc.cpp b/core/fxcodec/jbig2/JBig2_HtrdProc.cpp
index fb2257e853..7d11482225 100644
--- a/core/fxcodec/jbig2/JBig2_HtrdProc.cpp
+++ b/core/fxcodec/jbig2/JBig2_HtrdProc.cpp
@@ -117,6 +117,9 @@ std::unique_ptr<CJBig2_Image> CJBig2_HTRDProc::DecodeMMR(
std::unique_ptr<CJBig2_Image> CJBig2_HTRDProc::DecodeImage(
const std::vector<std::unique_ptr<CJBig2_Image>>& GSPLANES) {
auto HTREG = pdfium::MakeUnique<CJBig2_Image>(HBW, HBH);
+ if (!HTREG->data())
+ return nullptr;
+
HTREG->fill(HDEFPIXEL);
std::vector<uint32_t> GSVALS(HGW * HGH);
for (uint32_t y = 0; y < HGH; ++y) {