Commit 8213fc2e authored by Edward Hervey's avatar Edward Hervey 🤘 Committed by Edward Hervey

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
parent 21eb9b49
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment