mkvparser: liberalize parsing of bad elements

Normally, if a sub-element of a cluster reports a size
that lies beyond the end of its enclosing cluster, we
would treat this as a malformed stream and immediately
terminate the parse.

However, if the sub-element is not a simple block or block
group, we would ignore the (sub)element anyway, so there
doesn't appear to be any harm in just concontinuing to
ignore the (sub)element, and treating this case as if
we had reached the end-of-cluster in the normal way.

Change-Id: I16c0a44f7458823ed579612d917b09ee08a8d90a
This commit is contained in:
Matthew Heaney
2013-01-10 19:16:58 -08:00
parent 2b09f9b53a
commit 8376a8e9d7

View File

@@ -21,7 +21,7 @@ void mkvparser::GetVersion(int& major, int& minor, int& build, int& revision)
major = 1;
minor = 0;
build = 0;
revision = 26;
revision = 27;
}
long long mkvparser::ReadUInt(IMkvReader* pReader, long long pos, long& len)
@@ -7228,7 +7228,13 @@ long Cluster::Parse(long long& pos, long& len) const
if (cluster_stop >= 0)
{
if (block_stop > cluster_stop)
{
if ((id == 0x20) || (id == 0x23))
return E_FILE_FORMAT_INVALID;
pos = cluster_stop;
break;
}
}
else if ((total >= 0) && (block_stop > total))
{