[libdvbpsi-devel] CAT decoding - bug

Angelo Schiavone angelo.schiavone at gmail.com
Tue Jan 22 16:11:04 CET 2013


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;

    }

}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/libdvbpsi-devel/attachments/20130122/c1aa098a/attachment.html>


More information about the libdvbpsi-devel mailing list