Commit 5338c7ff authored by Khushal's avatar Khushal Committed by Commit Bot

blink: Handle peekPixels failure in ImageDataBuffer and add msan checks.

R=fserb@chromium.org

Bug: 1018629
Change-Id: I8b552e92456bd8ee79e04f8f55e3c27a2d53e56f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1922305
Auto-Submit: Khushal <khushalsagar@chromium.org>
Commit-Queue: Fernando Serboncini <fserb@chromium.org>
Reviewed-by: default avatarFernando Serboncini <fserb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#718268}
parent 722058c2
......@@ -34,6 +34,7 @@
#include <memory>
#include "base/compiler_specific.h"
#include "base/memory/ptr_util.h"
#include "third_party/blink/renderer/platform/graphics/static_bitmap_image.h"
#include "third_party/blink/renderer/platform/image-encoders/image_encoder.h"
......@@ -78,10 +79,12 @@ ImageDataBuffer::ImageDataBuffer(scoped_refptr<StaticBitmapImage> image) {
pixmap_.reset();
return;
}
MSAN_CHECK_MEM_IS_INITIALIZED(pixmap_.addr(), pixmap_.computeByteSize());
retained_image_ = SkImage::MakeRasterData(info, std::move(data), rowBytes);
} else {
if (!retained_image_->peekPixels(&pixmap_))
return;
MSAN_CHECK_MEM_IS_INITIALIZED(pixmap_.addr(), pixmap_.computeByteSize());
}
is_valid_ = true;
size_ = IntSize(image->width(), image->height());
......@@ -161,7 +164,9 @@ String ImageDataBuffer::ToDataURL(const ImageEncodingMimeType mime_type,
if (!pixmap.colorSpace()->isSRGB()) {
skia_image = SkImage::MakeFromRaster(pixmap, nullptr, nullptr);
skia_image = skia_image->makeColorSpace(SkColorSpace::MakeSRGB());
skia_image->peekPixels(&pixmap);
if (!skia_image->peekPixels(&pixmap))
return "data:,";
MSAN_CHECK_MEM_IS_INITIALIZED(pixmap.addr(), pixmap.computeByteSize());
}
pixmap.setColorSpace(nullptr);
}
......
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