qtdemux: Handle bogus caption samples

Corrupted files could potentially have multiple cdat/cdt2 atoms in
a sample entry, which is unclear how to handle.

Ignore repeated ones.

CID #1434162
CID #1434159
This commit is contained in:
Edward Hervey 2018-04-11 08:42:54 +02:00 committed by Edward Hervey
parent 21eb9b49be
commit 8213fc2edf

View file

@ -5439,14 +5439,23 @@ extract_cc_from_data (QtDemuxStream * stream, const guint8 * data, gsize size,
guint32 new_atom_length = QT_UINT32 (data + atom_length);
if (size <= atom_length + new_atom_length) {
fourcc = QT_FOURCC (data + atom_length + 4);
if (fourcc == FOURCC_cdat)
cdat =
convert_to_ccdata (data + atom_length + 8, new_atom_length - 8,
1, &cdat_size);
else
cdt2 =
convert_to_ccdata (data + atom_length + 8, new_atom_length - 8,
2, &cdt2_size);
if (fourcc == FOURCC_cdat) {
if (cdat == NULL)
cdat =
convert_to_ccdata (data + atom_length + 8,
new_atom_length - 8, 1, &cdat_size);
else
GST_WARNING_OBJECT (stream->pad,
"Got multiple [cdat] atoms in a c608 sample. This is unsupported for now. Please file a bug");
} else {
if (cdt2 == NULL)
cdt2 =
convert_to_ccdata (data + atom_length + 8,
new_atom_length - 8, 2, &cdt2_size);
else
GST_WARNING_OBJECT (stream->pad,
"Got multiple [cdt2] atoms in a c608 sample. This is unsupported for now. Please file a bug");
}
}
}
*cclen = cdat_size + cdt2_size;