[linux-dvb] [PATCH] Bug in section filtering (and fix)
js at linuxtv.org
Tue Sep 27 00:05:06 CEST 2005
just to let you know that this report and fix is highly appreciated,
but I simply am short of time and didn't have time to look into
the details to verify your fix. It won't drop off my TODO-list.
Would be cool if someone else had the time...
On Thu, Sep 22, 2005 at 06:53:59PM +0100, Mark Adams wrote:
> There is a bug in dvb-core which causes large MPEG sections to be lost
> when they follow very small sections.
> The problem happens when two sections begin in the same transport
> packet. The dvb_demux code resets its buffer only before the first of
> these sections. This means that when the second (or subsequent)
> section begins, there is up to 182 bytes of buffer space already used.
> If the following section is close to the maximum size, it currently
> won't fit in the (4096-byte) buffer and is thrown away.
> The fix is simply to enlarge the buffer by the size of one transport
> packet and correct one usage of the SECFEED_SIZE definition where what
> is really meant is the maximum size of a section.
> I propose the following patch:
> --- demux.h.orig 2005-03-02 07:37:55.000000000 +0000
> +++ demux.h 2005-09-21 18:41:10.000000000 +0100
> @@ -47,8 +47,11 @@
> * DMX_MAX_SECFEED_SIZE: Maximum length (in bytes) of a private
> section feed filter.
> +#ifndef DMX_MAX_SECTION_SIZE
> +#define DMX_MAX_SECTION_SIZE 4096
> #ifndef DMX_MAX_SECFEED_SIZE
> -#define DMX_MAX_SECFEED_SIZE 4096
> +#define DMX_MAX_SECFEED_SIZE (DMX_MAX_SECTION_SIZE+188)
> --- dvb_demux.c.orig 2005-03-02 07:37:49.000000000 +0000
> +++ dvb_demux.c 2005-09-21 18:42:25.000000000 +0100
> @@ -302,7 +302,7 @@ static int dvb_dmx_swfilter_section_copy
> for(n = 0; sec->secbufp + 2 < limit; n++)
> seclen = section_length(sec->secbuf);
> - if(seclen <= 0 || seclen > DMX_MAX_SECFEED_SIZE
> + if(seclen <= 0 || seclen > DMX_MAX_SECTION_SIZE
> || seclen + sec->secbufp > limit)
> return 0;
> sec->seclen = seclen;
> Signed-off-by: Mark Adams <mark147m at gmail.com>
> linux-dvb mailing list
> linux-dvb at linuxtv.org
More information about the linux-dvb