Bug 1228314 - added static_cast<int64> in order to avoid overflow. r?seth
MozReview-Commit-ID: KY3qpIlzE5K
--- a/image/SurfaceCache.cpp
+++ b/image/SurfaceCache.cpp
@@ -322,17 +322,18 @@ public:
continue;
}
SurfaceKey bestMatchKey = bestMatch->GetSurfaceKey();
// Compare sizes. We use an area-based heuristic here instead of computing a
// truly optimal answer, since it seems very unlikely to make a difference
// for realistic sizes.
- int64_t idealArea = idealKey.Size().width * idealKey.Size().height;
+ int64_t idealArea = static_cast<int64_t>(idealKey.Size().width) *
+ static_cast<int64_t>(idealKey.Size().height);
int64_t surfaceArea = aSurfaceKey.Size().width * aSurfaceKey.Size().height;
int64_t bestMatchArea =
bestMatchKey.Size().width * bestMatchKey.Size().height;
// If the best match is smaller than the ideal size, prefer bigger sizes.
if (bestMatchArea < idealArea) {
if (surfaceArea > bestMatchArea) {
bestMatch = surface;