mkvparser: Fix potential overflow in Block::Parse

BUG=b/65045341

Change-Id: I198e72ea3859d2382a34e1e6dca957f9323af278
This commit is contained in:
Vignesh Venkatasubramanian 2017-08-25 11:28:01 -07:00
parent 245e7a258a
commit 86fa6dc2cb

View File

@ -7911,6 +7911,10 @@ long Block::Parse(const Cluster* pCluster) {
return E_FILE_FORMAT_INVALID;
curr.len = static_cast<long>(frame_size);
// Check if size + curr.len could overflow.
if (size > LLONG_MAX - curr.len) {
return E_FILE_FORMAT_INVALID;
}
size += curr.len; // contribution of this frame
--frame_count;