Re: CAT decoding - bug

Jean-Paul Saman <[email protected]>
Newsgroups gmane.comp.video.videolan.libdvbpsi.devel
Message-ID <CAK9US3BxnVBGWmCa2hCU8woWvpC8Xg1=zu06dpWXeWnHu9nY8Q@mail.gmail.com>
Angelo,

Again thanks for finding this bug. I checked ITU-T Rec H.222.0 and you are
correct.
At this point p_section->payload_start points at the beginning of the
descriptors for this PSI section.

And adding 5 to the payload start at this point is plain wrong. I would not
be surprised if more PSI sections
suffer from the same type of bug. Could you please sent a git-patch for
each one you come across in your testing?

On Tue, Jan 22, 2013 at 4:11 PM, Angelo Schiavone <
[email protected]> wrote:

> Hi all,
> CAT decode function doesn't work very well in libpsisi 1.0.0, in fact
> it may skip the last descriptor of the cat descriptor loop, according to
> its length.
> the problem is that red highlighted +5 which is not necessary.
>
>
> void dvbpsi_cat_sections_decode(dvbpsi_cat_t* p_cat, dvbpsi_psi_section_t* p_section)
>
> {
>
>     uint8_t* p_byte;
>
>     while (p_section)
>
>     {
>
>         /* CAT descriptors */
>
>         p_byte = p_section->p_payload_start;
>
>         while (p_byte +5 <= p_section->p_payload_end)
>
>         {
>
>             uint8_t i_tag = p_byte[0];
>
>             uint8_t i_length = p_byte[1];
>
>             if (i_length + 2 <= p_section->p_payload_end - p_byte)
>
>                 dvbpsi_cat_descriptor_add(p_cat, i_tag, i_length, p_byte + 2);
>
>             p_byte += 2 + i_length;
>
>         }
>
>         p_section = p_section->p_next;
>
>     }
>
> }
>
>
> _______________________________________________
> libdvbpsi-devel mailing list
> [email protected]
> http://mailman.videolan.org/listinfo/libdvbpsi-devel
>
>
Kind regards,

Jean-Paul Saman

_______________________________________________
libdvbpsi-devel mailing list
[email protected]
http://mailman.videolan.org/listinfo/libdvbpsi-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.