Commit 059010de authored by Stephen Chenney's avatar Stephen Chenney Committed by Commit Bot

[PE] Fix a null ptr access in ImageBitmap

The ImageBitmap constructor that takes pixel data and a width and
height does not check for success of the skia MakeRasterCopy call,
that will return null for a host of reasons. Add the check.

R=junov@chromium.org
BUG=805972

Null check in ImageBitmap:ImageBitmap

Change-Id: I4cd8464b21c3b14488ae8a948864b091f17d006a
Reviewed-on: https://chromium-review.googlesource.com/887678Reviewed-by: default avatarFlorin Malita <fmalita@chromium.org>
Commit-Queue: Stephen Chenney <schenney@chromium.org>
Cr-Commit-Position: refs/heads/master@{#532976}
parent 71d9865a
...@@ -595,7 +595,10 @@ ImageBitmap::ImageBitmap(const void* pixel_data, ...@@ -595,7 +595,10 @@ ImageBitmap::ImageBitmap(const void* pixel_data,
: kUnpremul_SkAlphaType, : kUnpremul_SkAlphaType,
color_params.GetSkColorSpaceForSkSurfaces()); color_params.GetSkColorSpaceForSkSurfaces());
SkPixmap pixmap(info, pixel_data, info.bytesPerPixel() * width); SkPixmap pixmap(info, pixel_data, info.bytesPerPixel() * width);
image_ = StaticBitmapImage::Create(SkImage::MakeRasterCopy(pixmap)); sk_sp<SkImage> raster_copy = SkImage::MakeRasterCopy(pixmap);
if (!raster_copy)
return;
image_ = StaticBitmapImage::Create(std::move(raster_copy));
if (!image_) if (!image_)
return; return;
image_->SetOriginClean(is_image_bitmap_origin_clean); image_->SetOriginClean(is_image_bitmap_origin_clean);
......
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