From 68b7a52a0b9355b357d4bd72bca479916d115d7c Mon Sep 17 00:00:00 2001 From: Robert Phillips Date: Wed, 9 Nov 2016 08:03:21 -0500 Subject: [PATCH] Fix fuzzer bug BUG=663687 GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4580 Change-Id: I9e914a1134b8049cf62bb36d4a6145eb8487d4e6 Reviewed-on: https://skia-review.googlesource.com/4580 Reviewed-by: Robert Phillips Commit-Queue: Robert Phillips --- src/gpu/GrSurface.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gpu/GrSurface.cpp b/src/gpu/GrSurface.cpp index f2318793d2..7f571b875f 100644 --- a/src/gpu/GrSurface.cpp +++ b/src/gpu/GrSurface.cpp @@ -38,7 +38,7 @@ size_t GrSurface::WorstCaseSize(const GrSurfaceDesc& desc) { } SkASSERT(kUnknown_GrPixelConfig != desc.fConfig); SkASSERT(!GrPixelConfigIsCompressed(desc.fConfig)); - size_t colorBytes = desc.fWidth * desc.fHeight * GrBytesPerPixel(desc.fConfig); + size_t colorBytes = (size_t) desc.fWidth * desc.fHeight * GrBytesPerPixel(desc.fConfig); // This would be a nice assert to have (i.e., we aren't creating 0 width/height surfaces). // Unfortunately Chromium seems to want to do this. @@ -50,7 +50,7 @@ size_t GrSurface::WorstCaseSize(const GrSurfaceDesc& desc) { if (GrPixelConfigIsCompressed(desc.fConfig)) { size = GrCompressedFormatDataSize(desc.fConfig, desc.fWidth, desc.fHeight); } else { - size = desc.fWidth * desc.fHeight * GrBytesPerPixel(desc.fConfig); + size = (size_t) desc.fWidth * desc.fHeight * GrBytesPerPixel(desc.fConfig); } size += size/3; // in case we have to mipmap @@ -68,7 +68,7 @@ size_t GrSurface::ComputeSize(const GrSurfaceDesc& desc, if (GrPixelConfigIsCompressed(desc.fConfig)) { colorSize = GrCompressedFormatDataSize(desc.fConfig, desc.fWidth, desc.fHeight); } else { - colorSize = desc.fWidth * desc.fHeight * GrBytesPerPixel(desc.fConfig); + colorSize = (size_t) desc.fWidth * desc.fHeight * GrBytesPerPixel(desc.fConfig); } SkASSERT(colorSize > 0);