[libdvbpsi-devel] TOT decode - bug

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


Angelo,

Could you please sent a patch against
git://git.videolan.org/libdvbpsi.gitrepository using the git tool?

It makes reviewing your changes easier.

Thank you very much.

Kind regards,
Jean-Paul Saman


On Tue, Jan 22, 2013 at 5:03 PM, Angelo Schiavone <
angelo.schiavone at gmail.com> wrote:

> Hi again, TOT table does not decode correctly, it miss descriptors in the
> descriptors loop.
> That's because  p_byte += 7; is incremented after p_end is calculated
>
> p_end = p_byte + (   ((uint16_t)(p_section->p_payload_start[5] & 0x0f) << 8)
>
>                                  | p_section->p_payload_start[6]);
>
>
> Instead it should happen before p_end assignment, attached the correct version.
>
>
> void dvbpsi_tot_sections_decode(dvbpsi_t* p_dvbpsi, dvbpsi_tot_t* p_tot,
>
>                               dvbpsi_psi_section_t* p_section)
>
> {
>
>     if (p_section)
>
>     {
>
>         uint8_t* p_byte;
>
>          if (!dvbpsi_tot_section_valid(p_dvbpsi, p_section))
>
>             return;
>
>          p_byte = p_section->p_payload_start;
>
>         if (p_byte + 5 <= p_section->p_payload_end)
>
>         {
>
>             p_tot->i_utc_time = ((uint64_t)p_byte[0] << 32) |
>
>                                 ((uint64_t)p_byte[1] << 24) |
>
>                                 ((uint64_t)p_byte[2] << 16) |
>
>                                 ((uint64_t)p_byte[3] << 8) |
>
>                                  (uint64_t)p_byte[4];
>
>         }
>
>          /* If we have a TOT, extract the descriptors */
>
>         if (p_section->i_table_id == 0x73)
>
>         {
>
>             uint8_t* p_end;
>
>             p_byte += 7;
>
>             p_end = p_byte + (   ((uint16_t)(p_section->p_payload_start[5] & 0x0f) << 8)
>
>                                  | p_section->p_payload_start[6]);
>
>             while (p_byte+2 <= p_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_tot_descriptor_add(p_tot, i_tag, i_length, p_byte + 2);
>
>                 p_byte += 2 + i_length;
>
>             }
>
>         }
>
>     }
>
> }
>
>
> _______________________________________________
> libdvbpsi-devel mailing list
> libdvbpsi-devel at videolan.org
> http://mailman.videolan.org/listinfo/libdvbpsi-devel
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/libdvbpsi-devel/attachments/20130123/ec16e3e1/attachment-0001.html>


More information about the libdvbpsi-devel mailing list