add helper to check for overflow
pre-CL to aid in changing the convention for when we overflow
Bug: skia:
Change-Id: I1e34a18fefb80187787a1c0c8ed7ee3516744d24
Reviewed-on: https://skia-review.googlesource.com/57103
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
diff --git a/src/image/SkImage.cpp b/src/image/SkImage.cpp
index 705efae..7e1b238 100644
--- a/src/image/SkImage.cpp
+++ b/src/image/SkImage.cpp
@@ -423,7 +423,7 @@
size_t rowBytes = info.minRowBytes();
size_t size = info.computeByteSize(rowBytes);
- if (size == 0) {
+ if (SkImageInfo::ByteSizeOverflowed(size)) {
return nullptr;
}
auto data = SkData::MakeUninitialized(size);