mpegtsdemux: Avoid parsing section without enough data

This is actually a workaround (we'll be skipping the upcoming section)

This will only happen for sections where the beginning is located within
the last 8 bytes of a packet (which is the minimum we need to properly
identify any section beginning).

Later we should figure out a way to store those bytes and mark that
some analysis needs to happen. The probability of this happening is
too low for me to care right now and do that fix. There is a good chance
that section will eventually be repeated and won't end up on such border.
This commit is contained in:
Edward Hervey 2013-07-08 08:44:43 +02:00
parent 0ef3e3c7d2
commit 8ca1751f00

View file

@ -972,7 +972,9 @@ accumulate_data:
res = section;
}
if (data == packet->data_end || *data == 0xff) {
/* FIXME : We need at least 8 bytes with current algorithm :(
* We might end up losing sections that start across two packets (srsl...) */
if (data > packet->data_end - 8 || *data == 0xff) {
/* flush stuffing bytes and leave */
mpegts_packetizer_clear_section (stream);
goto out;