Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(111)

Unified Diff: tests/BitmapTest.cpp

Issue 871993003: check for too-large rowBytes (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: use cast to keep minRB signed (matching the rest of the code) Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/core/SkMallocPixelRef.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/BitmapTest.cpp
diff --git a/tests/BitmapTest.cpp b/tests/BitmapTest.cpp
index ef6953191230925e3aec09866e345a4956e3223e..f3d8faa967c7ae99c311e63cf4e3d5f73cc260de 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);
}
« no previous file with comments | « src/core/SkMallocPixelRef.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698