Commit 7cae3380 authored by sugoi@chromium.org's avatar sugoi@chromium.org

Moved misplaced allDataReceived() assert

The spots where allDataReceived() was checked in an if statement, or
asserted against were switched, so the release build was going right
through the code in getYUVComponentSizes(), without returning early,
which could lead to a crash.

Added safety checks inside the JPEG decoder just in case we get into
this situation some other way.

BUG=410788,410586

Review URL: https://codereview.chromium.org/528293003

git-svn-id: svn://svn.chromium.org/blink/trunk@181439 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 6b34d85e
......@@ -155,8 +155,7 @@ bool ImageFrameGenerator::decodeToYUV(void* planes[3], size_t rowBytes[3])
m_data.data(&data, &allDataReceived);
// FIXME: YUV decoding does not currently support progressive decoding.
if (!allDataReceived)
return false;
ASSERT(allDataReceived);
OwnPtr<ImageDecoder> decoder = ImageDecoder::create(*data, ImageSource::AlphaPremultiplied, ImageSource::GammaAndColorProfileApplied);
if (!decoder)
......@@ -303,7 +302,8 @@ bool ImageFrameGenerator::getYUVComponentSizes(SkISize componentSizes[3])
m_data.data(&data, &allDataReceived);
// FIXME: YUV decoding does not currently support progressive decoding.
ASSERT(allDataReceived);
if (!allDataReceived)
return false;
OwnPtr<ImageDecoder> decoder = ImageDecoder::create(*data, ImageSource::AlphaPremultiplied, ImageSource::GammaAndColorProfileApplied);
if (!decoder)
......
......@@ -263,7 +263,11 @@ static yuv_subsampling yuvSubsampling(const jpeg_decompress_struct& info)
{
if ((DCTSIZE == 8)
&& (info.num_components == 3)
&& (info.comps_in_scan >= info.num_components)
&& (info.scale_denom <= 8)
&& (info.cur_comp_info[0])
&& (info.cur_comp_info[1])
&& (info.cur_comp_info[2])
&& (info.cur_comp_info[1]->h_samp_factor == 1)
&& (info.cur_comp_info[1]->v_samp_factor == 1)
&& (info.cur_comp_info[2]->h_samp_factor == 1)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment