Re: TOT decode - bug
Angelo Schiavone <[email protected]>
| Newsgroups | gmane.comp.video.videolan.libdvbpsi.devel |
|---|---|
| Message-ID | <CADyCdYcyQVZsECy5=JA27XgZGN=x7iPPFj7=xm+hdtXV2xmp5Q@mail.gmail.com> |
Hi, NIT and BAT table already start at the right location but the problem with them is (as pointed out in the patch) with the calculation of p_end which needs a +2 otherwise decoder may miss last descriptor in the loop. attached the patch against last commit. thanks From 4dbf8cf04b0e1f38743f08c0d14416fe77e7cd05 Mon Sep 17 00:00:00 2001 From: Angelo Schiavone <[email protected]> Date: Thu, 24 Jan 2013 08:52:11 +0100 Subject: [PATCH] fixes NIT and BAT descriptors loop decoding, p_end is now correctly calculated --- src/tables/bat.c | 2 +- src/tables/nit.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tables/bat.c b/src/tables/bat.c index 9811795..efda516 100644 --- a/src/tables/bat.c +++ b/src/tables/bat.c @@ -489,7 +489,7 @@ void dvbpsi_bat_sections_decode(dvbpsi_bat_t* p_bat, p_byte += 2 + i_length; } - p_end = p_byte + (((uint16_t)(p_byte[0] & 0x0f) << 8) + p_end = 2 + p_byte + (((uint16_t)(p_byte[0] & 0x0f) << 8) | p_byte[1]); if (p_end > p_section->p_payload_end) p_end = p_section->p_payload_end; diff --git a/src/tables/nit.c b/src/tables/nit.c index 1532e3d..dce830e 100644 --- a/src/tables/nit.c +++ b/src/tables/nit.c @@ -474,7 +474,7 @@ void dvbpsi_nit_sections_decode(dvbpsi_nit_t* p_nit, } /* Transport stream loop length */ - p_end = p_byte + (((uint16_t)(p_byte[0] & 0x0f) << 8) + p_end = 2 + p_byte + (((uint16_t)(p_byte[0] & 0x0f) << 8) | p_byte[1]); if (p_end > p_section->p_payload_end) p_end = p_section->p_payload_end; -- 1.7.9.5 2013/1/23 Jean-Paul Saman <[email protected]> > Oops pressed send too soon. > > > On Wed, Jan 23, 2013 at 8:22 PM, Jean-Paul Saman <[email protected]>wrote: > >> Angelo, >> >> On Wed, Jan 23, 2013 at 3:16 PM, Angelo Schiavone < >> [email protected]> wrote: >> >>> here is the git patch. >> >> >> In the end I did not use your patches to fix the issues. I just pushed >> changes that should fix all >> the bugs you noticed. It does need some wider testing so please try it ;) >> >> If you find any issue, then please report them again. >> >> Some feedback on your patch: >> - both NIT and BAT table already start at the right location since p_byte >> is defined as: >> > > p_byte = p_section->p_playload_start + 2; > > - the other change in BAT table was correctly spotted > - you were right about the CAT table > - the CRC32 validation for TOT table has been solved in another way. > > Kind regards, > Jean-Paul Saman > _______________________________________________ libdvbpsi-devel mailing list [email protected] http://mailman.videolan.org/listinfo/libdvbpsi-devel
fix_bat_nit_desc.patch
(application/octet-stream, 1.4 KB)
From 4dbf8cf04b0e1f38743f08c0d14416fe77e7cd05 Mon Sep 17 00:00:00 2001 From: Angelo Schiavone <[email protected]> Date: Thu, 24 Jan 2013 08:52:11 +0100 Subject: [PATCH] fixes NIT and BAT descriptors loop decoding, p_end is now correctly calculated --- src/tables/bat.c | 2 +- src/tables/nit.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tables/bat.c b/src/tables/bat.c index 9811795..efda516 100644 --- a/src/tables/bat.c +++ b/src/tables/bat.c @@ -489,7 +489,7 @@ void dvbpsi_bat_sections_decode(dvbpsi_bat_t* p_bat, p_byte += 2 + i_length; } - p_end = p_byte + (((uint16_t)(p_byte[0] & 0x0f) << 8) + p_end = 2 + p_byte + (((uint16_t)(p_byte[0] & 0x0f) << 8) | p_byte[1]); if (p_end > p_section->p_payload_end) p_end = p_section->p_payload_end; diff --git a/src/tables/nit.c b/src/tables/nit.c index 1532e3d..dce830e 100644 --- a/src/tables/nit.c +++ b/src/tables/nit.c @@ -474,7 +474,7 @@ void dvbpsi_nit_sections_decode(dvbpsi_nit_t* p_nit, } /* Transport stream loop length */ - p_end = p_byte + (((uint16_t)(p_byte[0] & 0x0f) << 8) + p_end = 2 + p_byte + (((uint16_t)(p_byte[0] & 0x0f) << 8) | p_byte[1]); if (p_end > p_section->p_payload_end) p_end = p_section->p_payload_end; -- 1.7.9.5