Re: TOT decode - bug
Jean-Paul Saman <[email protected]>
| Newsgroups | gmane.comp.video.videolan.libdvbpsi.devel |
|---|---|
| Message-ID | <CAK9US3BtBomvSh4EW3nZXc2d2DfAYMwf3721ZD_zoWTLGRwKWA@mail.gmail.com> |
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 < [email protected]> 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 > [email protected] > http://mailman.videolan.org/listinfo/libdvbpsi-devel > > _______________________________________________ libdvbpsi-devel mailing list [email protected] http://mailman.videolan.org/listinfo/libdvbpsi-devel