CAT decoding - bug

Angelo Schiavone <[email protected]>
Newsgroups gmane.comp.video.videolan.libdvbpsi.devel
Message-ID <CADyCdYcjjho7MMr+S4Pjjt5ca6uZbyaG2HoPdLzCZvd2j=JW+w@mail.gmail.com>
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
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.