[libdvbpsi-devel] TOT decode - bug

Angelo Schiavone angelo.schiavone at gmail.com
Thu Jan 24 09:19:20 CET 2013


NIT and BAT p_end needs a + 2 because Transport stream loop length does not

include its 2 bytes; it represents the amount of bytes in the loop,
excluding itself bytes.


2013/1/24 Angelo Schiavone <angelo.schiavone at 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 <angelo.schiavone at screen.it>
> 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 <jpsaman at videolan.org>
>
>> Oops pressed send too soon.
>>
>>
>> On Wed, Jan 23, 2013 at 8:22 PM, Jean-Paul Saman <jpsaman at videolan.org>wrote:
>>
>>> Angelo,
>>>
>>> On Wed, Jan 23, 2013 at 3:16 PM, Angelo Schiavone <
>>> angelo.schiavone at gmail.com> 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
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/libdvbpsi-devel/attachments/20130124/fcca2e41/attachment.html>


More information about the libdvbpsi-devel mailing list