public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Michael Krufky <mkrufky@m1k.net>
To: Andrew Morton <akpm@osdl.org>
Cc: linux-kernel@vger.kernel.org, linux-dvb-maintainer@linuxtv.org
Subject: [PATCH 34/37] dvb: fix bug in demux that caused lost mpeg sections
Date: Tue, 01 Nov 2005 03:16:25 -0500	[thread overview]
Message-ID: <43672459.7050402@m1k.net> (raw)

[-- Attachment #1: Type: text/plain, Size: 2 bytes --]




[-- Attachment #2: 2411.patch --]
[-- Type: text/x-patch, Size: 1859 bytes --]

From: Mark Adams <mark147m@gmail.com>

Fix a bug in the software demux 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.

Signed-off-by: Mark Adams <mark147m@gmail.com>
Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>

 drivers/media/dvb/dvb-core/demux.h     |    5 ++++-
 drivers/media/dvb/dvb-core/dvb_demux.c |    2 +-
 2 files changed, 5 insertions(+), 2 deletions(-)

--- linux-2.6.14-git3.orig/drivers/media/dvb/dvb-core/demux.h
+++ linux-2.6.14-git3/drivers/media/dvb/dvb-core/demux.h
@@ -48,8 +48,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
+#endif
 #ifndef DMX_MAX_SECFEED_SIZE
-#define DMX_MAX_SECFEED_SIZE 4096
+#define DMX_MAX_SECFEED_SIZE (DMX_MAX_SECTION_SIZE + 188)
 #endif
 
 
--- linux-2.6.14-git3.orig/drivers/media/dvb/dvb-core/dvb_demux.c
+++ linux-2.6.14-git3/drivers/media/dvb/dvb-core/dvb_demux.c
@@ -246,7 +246,7 @@
 
 	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;


                 reply	other threads:[~2005-11-01  8:20 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=43672459.7050402@m1k.net \
    --to=mkrufky@m1k.net \
    --cc=akpm@osdl.org \
    --cc=linux-dvb-maintainer@linuxtv.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox