Chromium Code Reviews| Index: content/common/gpu/media/h264_decoder.cc |
| diff --git a/content/common/gpu/media/h264_decoder.cc b/content/common/gpu/media/h264_decoder.cc |
| index 46ffa2a45085f0b554898ad149ef551696e38bc9..f8504f3c53cec01b970b2c8df04b13036a669172 100644 |
| --- a/content/common/gpu/media/h264_decoder.cc |
| +++ b/content/common/gpu/media/h264_decoder.cc |
| @@ -1086,6 +1086,13 @@ bool H264Decoder::ProcessSPS(int sps_id, bool* need_new_buffers) { |
| int height_mb = (2 - sps->frame_mbs_only_flag) * |
| (sps->pic_height_in_map_units_minus1 + 1); |
| + if (width_mb > std::numeric_limits<int>::max() / 16 || |
|
Pawel Osciak
2016/04/20 04:22:09
Could we perhaps use:
base::IsValueInRangeForNumer
servolk
2016/04/20 17:32:53
Well, we are actually trying to avoid integer over
Pawel Osciak
2016/04/21 01:03:53
Yes, unless the result was of a larger type:
int a
servolk
2016/04/21 01:24:06
First of all, you probably meant 16ull, as 16u is
|
| + height_mb > std::numeric_limits<int>::max() / 16) { |
| + DVLOG(1) << "Picture size is too big: width_mb=" << width_mb |
| + << " height_mb=" << height_mb; |
| + return false; |
| + } |
| + |
| gfx::Size new_pic_size(16 * width_mb, 16 * height_mb); |
| if (new_pic_size.IsEmpty()) { |
| DVLOG(1) << "Invalid picture size: " << new_pic_size.ToString(); |