From 2ff257bd95c732b9cebc3aac03fbed72d6e6082a Mon Sep 17 00:00:00 2001 From: reed Date: Fri, 23 Jan 2015 07:51:14 -0800 Subject: check for too-large rowBytes BUG=446164 Review URL: https://codereview.chromium.org/871993003 --- tests/BitmapTest.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'tests/BitmapTest.cpp') diff --git a/tests/BitmapTest.cpp b/tests/BitmapTest.cpp index ef69531912..f3d8faa967 100644 --- a/tests/BitmapTest.cpp +++ b/tests/BitmapTest.cpp @@ -6,9 +6,22 @@ */ #include "SkBitmap.h" - +#include "SkMallocPixelRef.h" #include "Test.h" +// https://code.google.com/p/chromium/issues/detail?id=446164 +static void test_bigalloc(skiatest::Reporter* reporter) { + const int width = 0x40000001; + const int height = 0x00000096; + const SkImageInfo info = SkImageInfo::MakeN32Premul(width, height); + + SkBitmap bm; + REPORTER_ASSERT(reporter, !bm.tryAllocPixels(info)); + + SkPixelRef* pr = SkMallocPixelRef::NewAllocate(info, info.minRowBytes(), NULL); + REPORTER_ASSERT(reporter, !pr); +} + static void test_allocpixels(skiatest::Reporter* reporter) { const int width = 10; const int height = 10; @@ -81,4 +94,5 @@ DEF_TEST(Bitmap, reporter) { test_bigwidth(reporter); test_allocpixels(reporter); + test_bigalloc(reporter); } -- cgit v1.2.3