UUIDs can have their high bit set

mkvparser::UnserializeUInt() assumes that unsigned values never have
their high bit set. This is too limiting for UUIDs. In addition, the
Chapters::Atom::Parse() method would truncate a "negative" 64-bit UUID
value to 32 bits and return the truncated value as a status code.
This value then might or might not be treated as an error by the caller
depending on whether the truncated value was itself negative.

Change-Id: I15624ac62d0b02691a1405ee6a5f7eb441b3bc48
This commit is contained in:
Vignesh Venkatasubramanian 2014-05-16 11:25:22 -07:00
parent 249629d46c
commit d13c017744

View File

@ -130,6 +130,8 @@ long long mkvparser::GetUIntLength(IMkvReader* pReader, long long pos,
return 0; // success
}
// TODO(vigneshv): This function assumes that unsigned values never have their
// high bit set.
long long mkvparser::UnserializeUInt(IMkvReader* pReader, long long pos,
long long size) {
assert(pReader);
@ -4128,12 +4130,13 @@ long Chapters::Atom::Parse(IMkvReader* pReader, long long pos, long long size) {
if (status < 0) // error
return status;
} else if (id == 0x33C4) { // UID ID
const long long val = UnserializeUInt(pReader, pos, size);
long long val;
status = UnserializeInt(pReader, pos, size, val);
if (val < 0) // error
return static_cast<long>(val);
return status;
m_uid = val;
m_uid = static_cast<unsigned long long>(val);
} else if (id == 0x11) { // TimeStart ID
const long long val = UnserializeUInt(pReader, pos, size);