Commit 2bb5a856 authored by tnagel@chromium.org's avatar tnagel@chromium.org

Fix invalid array access in OnRobustJPEGDecodeImage().

This doesn't seem to be a problem for release builds, but in debug builds the invalid array access causes STL errors:

    error: attempt to subscript container with out-of-bounds index 0, but
    container only holds 0 elements.

BUG=401161

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@287884 0039d316-1c4b-4281-b951-d872f2087c98
parent fe758c03
......@@ -232,7 +232,8 @@ void ChromeContentUtilityClient::OnCreateZipFile(
void ChromeContentUtilityClient::OnRobustJPEGDecodeImage(
const std::vector<unsigned char>& encoded_data) {
// Our robust jpeg decoding is using IJG libjpeg.
if (gfx::JPEGCodec::JpegLibraryVariant() == gfx::JPEGCodec::IJG_LIBJPEG) {
if (gfx::JPEGCodec::JpegLibraryVariant() == gfx::JPEGCodec::IJG_LIBJPEG &&
!encoded_data.empty()) {
scoped_ptr<SkBitmap> decoded_image(gfx::JPEGCodec::Decode(
&encoded_data[0], encoded_data.size()));
if (!decoded_image.get() || decoded_image->empty()) {
......
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