[libdvbpsi-devel] CAT decoding - bug

Jean-Paul Saman jpsaman at videolan.org
Wed Jan 23 14:45:08 CET 2013


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 <
angelo.schiavone at gmail.com> 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
> libdvbpsi-devel at videolan.org
> http://mailman.videolan.org/listinfo/libdvbpsi-devel
>
>
Kind regards,

Jean-Paul Saman
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/libdvbpsi-devel/attachments/20130123/7f6b77a6/attachment.html>


More information about the libdvbpsi-devel mailing list