mpegtspacketizer: Fix off-by-one error

This went un-noticed for 6 years :( The issue is that for short
sections (without subtables and CRC), we would always fail when
checking whether we had enough data or not and then default to the
long section checking.

Use the long section checking would then cause interesting side-effects
for short sections (such as believing they were already seen and therefore
would be dropped/ignored).
This commit is contained in:
Edward Hervey 2019-09-26 17:13:30 +02:00 committed by Edward Hervey
parent 10d4c0c511
commit 878edacc05

View file

@ -1092,7 +1092,7 @@ section_start:
GST_DEBUG ("Short packet");
section_length = (GST_READ_UINT16_BE (data + 1) & 0xfff) + 3;
/* Only do fast-path if we have enough byte */
if (section_length < packet->data_end - data) {
if (data + section_length <= packet->data_end) {
if ((section =
gst_mpegts_section_new (packet->pid, g_memdup (data,
section_length), section_length))) {