Commit 6098e4e8 authored by Akhila Veerapuraju's avatar Akhila Veerapuraju Committed by Commit Bot

Increase bitmap deserialization limits in mojom transfer

The change https://crrev.com/c/2368484 introduced bitmap limits while
deserializing the bitmap data in mojom transfer. This regressed large
bitmap transfers b/n the processes which used to work before
(Ex: Navigator.clipboard.write)

The limits were chosen arbitrarily to validate that the image isn't
incredibly large due to any programming error, but 32k is not a fair
limit. Increase the limit to 64k which can accommodate images from the
largest possible canvas(64k is the canvas max possible dimension)

Bug: 1142852
Change-Id: I7c6b32d8ac8549b9053178d477e7c7610add3f3f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2504012Reviewed-by: default avatarGreg Kerr <kerrnel@chromium.org>
Reviewed-by: default avatarJames Cook <jamescook@chromium.org>
Reviewed-by: default avatarKen Rockot <rockot@google.com>
Reviewed-by: default avatarMike Klein <mtklein@google.com>
Commit-Queue: Akhila Veerapuraju <dhveerap@microsoft.com>
Cr-Commit-Position: refs/heads/master@{#821750}
parent 1c5d9e6d
...@@ -10,9 +10,11 @@ namespace mojo { ...@@ -10,9 +10,11 @@ namespace mojo {
namespace { namespace {
// Maximum reasonable width and height. We don't try to deserialize bitmaps // Maximum reasonable width and height. We don't try to deserialize bitmaps
// bigger than these dimensions. Arbitrarily chosen. // bigger than these dimensions.
constexpr int kMaxWidth = 32 * 1024; // These limits are fairly large to accommodate images from the largest possible
constexpr int kMaxHeight = 32 * 1024; // canvas.
constexpr int kMaxWidth = 64 * 1024;
constexpr int kMaxHeight = 64 * 1024;
// A custom SkPixelRef subclass to wrap a BigBuffer storing the pixel data. // A custom SkPixelRef subclass to wrap a BigBuffer storing the pixel data.
class BigBufferPixelRef final : public SkPixelRef { class BigBufferPixelRef final : public SkPixelRef {
......
...@@ -87,7 +87,7 @@ TEST(StructTraitsTest, Bitmap) { ...@@ -87,7 +87,7 @@ TEST(StructTraitsTest, Bitmap) {
TEST(StructTraitsTest, BitmapTooWideToSerialize) { TEST(StructTraitsTest, BitmapTooWideToSerialize) {
SkBitmap input; SkBitmap input;
constexpr int kTooWide = 32 * 1024 + 1; constexpr int kTooWide = 64 * 1024 + 1;
input.allocPixels( input.allocPixels(
SkImageInfo::MakeN32(kTooWide, 1, SkAlphaType::kUnpremul_SkAlphaType)); SkImageInfo::MakeN32(kTooWide, 1, SkAlphaType::kUnpremul_SkAlphaType));
input.eraseColor(SK_ColorYELLOW); input.eraseColor(SK_ColorYELLOW);
...@@ -98,7 +98,7 @@ TEST(StructTraitsTest, BitmapTooWideToSerialize) { ...@@ -98,7 +98,7 @@ TEST(StructTraitsTest, BitmapTooWideToSerialize) {
TEST(StructTraitsTest, BitmapTooTallToSerialize) { TEST(StructTraitsTest, BitmapTooTallToSerialize) {
SkBitmap input; SkBitmap input;
constexpr int kTooTall = 32 * 1024 + 1; constexpr int kTooTall = 64 * 1024 + 1;
input.allocPixels( input.allocPixels(
SkImageInfo::MakeN32(1, kTooTall, SkAlphaType::kUnpremul_SkAlphaType)); SkImageInfo::MakeN32(1, kTooTall, SkAlphaType::kUnpremul_SkAlphaType));
input.eraseColor(SK_ColorYELLOW); input.eraseColor(SK_ColorYELLOW);
......
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