mkvparser: ignore 0-size elements in TrackEntry
ParseTrackEntry handled MKVs with 0-sized EBML elements as malformed. Relaxing this and allow empty elements to allow parsing such MKV content. Change-Id: I7e430e9b2d177df7fe1e656546f63ee8673e784e
This commit is contained in:
@@ -6533,35 +6533,29 @@ long Tracks::ParseTrackEntry(
|
||||
if (status < 0) //error
|
||||
return status;
|
||||
|
||||
if (size < 0)
|
||||
return E_FILE_FORMAT_INVALID;
|
||||
|
||||
const long long start = pos;
|
||||
|
||||
if (id == 0x60) // VideoSettings ID
|
||||
{
|
||||
if (size <= 0)
|
||||
return E_FILE_FORMAT_INVALID;
|
||||
|
||||
v.start = start;
|
||||
v.size = size;
|
||||
}
|
||||
else if (id == 0x61) // AudioSettings ID
|
||||
{
|
||||
if (size <= 0)
|
||||
return E_FILE_FORMAT_INVALID;
|
||||
|
||||
a.start = start;
|
||||
a.size = size;
|
||||
}
|
||||
else if (id == 0x2D80) // ContentEncodings ID
|
||||
{
|
||||
if (size <= 0)
|
||||
return E_FILE_FORMAT_INVALID;
|
||||
|
||||
e.start = start;
|
||||
e.size = size;
|
||||
}
|
||||
else if (id == 0x33C5) //Track UID
|
||||
{
|
||||
if ((size <= 0) || (size > 8))
|
||||
if (size > 8)
|
||||
return E_FILE_FORMAT_INVALID;
|
||||
|
||||
info.uid = 0;
|
||||
@@ -6637,11 +6631,10 @@ long Tracks::ParseTrackEntry(
|
||||
info.codecPrivate = NULL;
|
||||
info.codecPrivateSize = 0;
|
||||
|
||||
if (size <= 0)
|
||||
return E_FILE_FORMAT_INVALID;
|
||||
|
||||
const size_t buflen = static_cast<size_t>(size);
|
||||
|
||||
if (buflen)
|
||||
{
|
||||
typedef unsigned char* buf_t;
|
||||
|
||||
const buf_t buf = new (std::nothrow) unsigned char[buflen];
|
||||
@@ -6660,6 +6653,7 @@ long Tracks::ParseTrackEntry(
|
||||
info.codecPrivate = buf;
|
||||
info.codecPrivateSize = buflen;
|
||||
}
|
||||
}
|
||||
else if (id == 0x058688) //Codec Name
|
||||
{
|
||||
const long status = UnserializeString(
|
||||
|
||||
Reference in New Issue
Block a user