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

Unified Diff: third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp

Issue 2170693003: Fix integer over flow issue in HTMLCanvasElement::canCreateImageBuffer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: use CheckedNumeric Created 4 years, 5 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp
diff --git a/third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp b/third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp
index 7c83d770df66171f3e4325b38a98605a2f7ad023..544b44bc0982249467386ea52996b17aed458419 100644
--- a/third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp
@@ -122,7 +122,9 @@ bool canCreateImageBuffer(const IntSize& size)
{
if (size.isEmpty())
return false;
- if (size.width() * size.height() > MaxCanvasArea)
+ CheckedNumeric<int> area = size.width();
+ area *= size.height();
+ if (!area.IsValid() || area.ValueOrDie() > MaxCanvasArea)
return false;
if (size.width() > MaxSkiaDim || size.height() > MaxSkiaDim)
return false;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698