Index: src/image/SkImage_Raster.cpp |
diff --git a/src/image/SkImage_Raster.cpp b/src/image/SkImage_Raster.cpp |
index 4636686e8d7e7811e161c69fe7deb87fba94cc8e..1dd57d6dc21c26d28d7c9218afb267e84977258a 100644 |
--- a/src/image/SkImage_Raster.cpp |
+++ b/src/image/SkImage_Raster.cpp |
@@ -186,11 +186,18 @@ SkImage* SkImage::NewFromGenerator(SkImageGenerator* generator) { |
if (!SkInstallDiscardablePixelRef(generator, &bitmap)) { |
return NULL; |
} |
+ if (0 == bitmap.width() || 0 == bitmap.height()) { |
+ return NULL; |
+ } |
+ |
return SkNEW_ARGS(SkImage_Raster, (bitmap, NULL)); |
} |
SkImage* SkNewImageFromPixelRef(const SkImageInfo& info, SkPixelRef* pr, size_t rowBytes, |
const SkSurfaceProps* props) { |
+ if (!SkImage_Raster::ValidArgs(info, rowBytes)) { |
+ return NULL; |
+ } |
return SkNEW_ARGS(SkImage_Raster, (info, pr, rowBytes, props)); |
} |