Chromium Code Reviews| Index: content/public/common/common_param_traits.cc |
| =================================================================== |
| --- content/public/common/common_param_traits.cc (revision 175167) |
| +++ content/public/common/common_param_traits.cc (working copy) |
| @@ -4,6 +4,8 @@ |
| #include "content/public/common/common_param_traits.h" |
| +#include <limits> |
| + |
| #include "content/public/common/content_constants.h" |
| #include "content/public/common/referrer.h" |
| #include "net/base/host_port_pair.h" |
| @@ -177,8 +179,9 @@ |
| PickleIterator* iter, |
| gfx::Size* r) { |
| int w, h; |
| - if (!m->ReadInt(iter, &w) || |
| - !m->ReadInt(iter, &h)) |
| + if (!m->ReadInt(iter, &w) || w < 0 || |
| + !m->ReadInt(iter, &h) || h < 0 || |
| + (h && w > ((std::numeric_limits<int>::max() / 4) / h))) |
|
danakj
2013/01/07 19:19:03
We already DCHECK that sizes have positive values
danakj
2013/01/07 19:21:52
Actually maybe we don't. I landed that CL but it w
jschuh
2013/01/07 22:24:14
I understand that generally, but in security sensi
jschuh
2013/01/07 22:24:14
Yep.
danakj
2013/01/07 22:56:37
Sure, I'm just not sure why you see something like
jschuh
2013/01/08 00:08:45
I appreciate that it seems arbitrary, but it's the
jschuh
2013/01/08 00:43:32
Antoine provided some context in was lacking (in t
|
| return false; |
| r->set_width(w); |
| r->set_height(h); |
| @@ -265,8 +268,9 @@ |
| int x, y, w, h; |
| if (!m->ReadInt(iter, &x) || |
| !m->ReadInt(iter, &y) || |
| - !m->ReadInt(iter, &w) || |
| - !m->ReadInt(iter, &h)) |
| + !m->ReadInt(iter, &w) || w < 0 || |
| + !m->ReadInt(iter, &h) || h < 0 || |
| + (h && w > ((std::numeric_limits<int>::max() / 4) / h))) |
|
piman
2013/01/07 19:05:56
nit: it would be even better to serialize p.origin
jschuh
2013/01/07 22:24:14
Yep.
|
| return false; |
| r->set_x(x); |
| r->set_y(y); |