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

Unified Diff: chrome/common/common_param_traits.cc

Issue 1582023: Apply a sanity limit to objects with width & height. (Closed) Base URL: svn://chrome-svn.corp.google.com/chrome/trunk/src/
Patch Set: '' Created 10 years, 8 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: chrome/common/common_param_traits.cc
===================================================================
--- chrome/common/common_param_traits.cc (revision 44106)
+++ chrome/common/common_param_traits.cc (working copy)
@@ -147,6 +147,9 @@
!m->ReadInt(iter, &w) ||
!m->ReadInt(iter, &h))
return false;
+ if (x < 0 || y < 0 || x >= (INT_MAX - w) || y >= (INT_MAX - h) ||
+ w < 0 || h < 0 || h >= ((INT_MAX / 16) / (w ? w : 1)))
+ return false;
r->set_x(x);
r->set_y(y);
r->set_width(w);
@@ -170,6 +173,8 @@
if (!m->ReadInt(iter, &w) ||
!m->ReadInt(iter, &h))
return false;
+ if (w < 0 || h < 0 || h >= ((INT_MAX / 16) / (w ? w : 1)))
+ return false;
r->set_width(w);
r->set_height(h);
return true;
« 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