Commit 54dd7e02 authored by Adrienne Walker's avatar Adrienne Walker Committed by Commit Bot

cc: Remove diagnostic checks for valid raster info

Unfortunately, most of the check lines have appeared in the wild,
but very rarely.  It seems likely this is a memory stomp elsewhere
leading to invalid parameters here.  If this was more reproducible,
or there was some content that could trigger this more regularly
I think we'd see a lot more reports or the same client.

Removed the diagnostic checks (since they could become out of sync
with Skia) and left the original check with a comment.

This reverts https://chromium-review.googlesource.com/#/c/511182/

Bug: 721744
Change-Id: I4f6deae8535b70afb5a24dd42b9b2bfcbfc37394
Reviewed-on: https://chromium-review.googlesource.com/575021Reviewed-by: default avatarccameron chromium <ccameron@chromium.org>
Commit-Queue: enne <enne@chromium.org>
Cr-Commit-Position: refs/heads/master@{#487260}
parent 12bbaee3
...@@ -24,58 +24,6 @@ RasterBufferProvider::~RasterBufferProvider() {} ...@@ -24,58 +24,6 @@ RasterBufferProvider::~RasterBufferProvider() {}
namespace { namespace {
// TODO(enne): http://crbug.com/721744. Add CHECKs for conditions that would
// cause Skia to not create a surface here to diagnose what's going wrong. This
// replicates SkSurfaceValidateRasterInfo and needs to be kept in sync with
// the corresponding Skia code. This code should be removed as quickly as
// possible once a diagnosis is made.
void CheckValidRasterInfo(const SkImageInfo& info,
void* pixels,
size_t row_bytes) {
CHECK(pixels);
CHECK(!info.isEmpty());
static const size_t kMaxTotalSize = SK_MaxS32;
int shift = 0;
switch (info.colorType()) {
case kAlpha_8_SkColorType:
CHECK(!info.colorSpace());
shift = 0;
break;
case kRGB_565_SkColorType:
CHECK(!info.colorSpace());
shift = 1;
break;
case kN32_SkColorType:
if (info.colorSpace())
CHECK(info.colorSpace()->gammaCloseToSRGB());
shift = 2;
break;
case kRGBA_F16_SkColorType:
if (info.colorSpace())
CHECK(info.colorSpace()->gammaIsLinear());
shift = 3;
break;
default:
CHECK(false) << "Unknown color type";
break;
}
static constexpr size_t kIgnoreRowBytesValue = static_cast<size_t>(~0);
if (kIgnoreRowBytesValue == row_bytes)
return;
uint64_t min_row_bytes = static_cast<uint64_t>(info.width()) << shift;
CHECK_LE(min_row_bytes, row_bytes);
size_t aligned_row_bytes = row_bytes >> shift << shift;
CHECK_EQ(aligned_row_bytes, row_bytes);
uint64_t size = sk_64_mul(info.height(), row_bytes);
CHECK_LE(size, kMaxTotalSize);
}
bool IsSupportedPlaybackToMemoryFormat(viz::ResourceFormat format) { bool IsSupportedPlaybackToMemoryFormat(viz::ResourceFormat format) {
switch (format) { switch (format) {
case viz::RGBA_4444: case viz::RGBA_4444:
...@@ -133,9 +81,12 @@ void RasterBufferProvider::PlaybackToMemory( ...@@ -133,9 +81,12 @@ void RasterBufferProvider::PlaybackToMemory(
case viz::RGBA_8888: case viz::RGBA_8888:
case viz::BGRA_8888: case viz::BGRA_8888:
case viz::RGBA_F16: { case viz::RGBA_F16: {
CheckValidRasterInfo(info, memory, stride);
sk_sp<SkSurface> surface = sk_sp<SkSurface> surface =
SkSurface::MakeRasterDirect(info, memory, stride, &surface_props); SkSurface::MakeRasterDirect(info, memory, stride, &surface_props);
// There are some rare crashes where this doesn't succeed and may be
// indicative of memory stomps elsewhere. Instead of displaying
// invalid content, just crash the renderer and try again.
// See: http://crbug.com/721744.
CHECK(surface); CHECK(surface);
raster_source->PlaybackToCanvas(surface->getCanvas(), target_color_space, raster_source->PlaybackToCanvas(surface->getCanvas(), target_color_space,
canvas_bitmap_rect, canvas_playback_rect, canvas_bitmap_rect, canvas_playback_rect,
......
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