diff options
author | dsinclair <dsinclair@chromium.org> | 2016-08-29 15:43:28 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-08-29 15:43:28 -0700 |
commit | 07f5fd57682700bcbba20f01d52a806676fd02ff (patch) | |
tree | 9a7e7cfc6de6ba564973ab6902c68075193f86f9 | |
parent | d24c3a60d0e6e5badef57d3baf55e5c3b6d4882e (diff) | |
download | pdfium-07f5fd57682700bcbba20f01d52a806676fd02ff.tar.xz |
Skip the channel if there is no data.
The JPX decoder needs to verify there is data associated with an image channel
before access. This was already done in one side of the if() but seems to be
missing from the other.
This Cl updates the loop to check the existance of channel data and to continue
iteration if none found.
BUG=chromium:637232
Review-Url: https://codereview.chromium.org/2291813002
-rw-r--r-- | core/fxcodec/codec/fx_codec_jpx_opj.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/core/fxcodec/codec/fx_codec_jpx_opj.cpp b/core/fxcodec/codec/fx_codec_jpx_opj.cpp index 9e72c509d7..ed9331974d 100644 --- a/core/fxcodec/codec/fx_codec_jpx_opj.cpp +++ b/core/fxcodec/codec/fx_codec_jpx_opj.cpp @@ -835,6 +835,9 @@ bool CJPX_Decoder::Decode(uint8_t* dest_buf, uint8_t* pScanline = pChannel + row * pitch; for (int col = 0; col < width; ++col) { uint8_t* pPixel = pScanline + col * image->numcomps; + if (!image->comps[channel].data) + continue; + int src = image->comps[channel].data[row * width + col]; src += image->comps[channel].sgnd ? 1 << (image->comps[channel].prec - 1) @@ -851,9 +854,9 @@ bool CJPX_Decoder::Decode(uint8_t* dest_buf, uint8_t* pScanline = pChannel + row * pitch; for (int col = 0; col < width; ++col) { uint8_t* pPixel = pScanline + col * image->numcomps; - if (!image->comps[channel].data) { + if (!image->comps[channel].data) continue; - } + int src = image->comps[channel].data[row * width + col]; src += image->comps[channel].sgnd ? 1 << (image->comps[channel].prec - 1) |