<div>Hi again, TOT table does not decode correctly, it miss descriptors in the descriptors loop.</div><div>That's because <span style="color:rgb(192,192,192)"> </span>p_byte<span style="color:rgb(192,192,192)"> </span>+=<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,128)">7</span>; is incremented after p_end is calculated</div>
<div><pre style="margin-top:0px;margin-bottom:0px">p_end<span style="color:rgb(192,192,192)"> </span>=<span style="color:rgb(192,192,192)"> </span>p_byte<span style="color:rgb(192,192,192)"> </span>+<span style="color:rgb(192,192,192)"> </span>(<span style="color:rgb(192,192,192)"> </span>((uint16_t)(p_section->p_payload_start[<span style="color:rgb(0,0,128)">5</span>]<span style="color:rgb(192,192,192)"> </span>&<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,128)">0x0f</span>)<span style="color:rgb(192,192,192)"> </span><<<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,128)">8</span>)</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)"> </span>|<span style="color:rgb(192,192,192)"> </span>p_section->p_payload_start[<span style="color:rgb(0,0,128)">6</span>]);</pre>
<pre style="margin-top:0px;margin-bottom:0px"><br></pre><pre style="margin-top:0px;margin-bottom:0px"><span style="font-family:arial;white-space:normal">Instead it should happen before p_end assignment, attached the correct version.</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><br></pre></div>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:#808000">void</span><span style="color:#c0c0c0"> </span>dvbpsi_tot_sections_decode(<span style="color:#800080">dvbpsi_t</span>*<span style="color:#c0c0c0"> </span>p_dvbpsi,<span style="color:#c0c0c0"> </span><span style="color:#800080">dvbpsi_tot_t</span>*<span style="color:#c0c0c0"> </span>p_tot,</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:#c0c0c0"> </span><span style="color:#800080">dvbpsi_psi_section_t</span>*<span style="color:#c0c0c0"> </span>p_section)</pre>
<pre style="margin-top:0px;margin-bottom:0px">{</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:#c0c0c0"> </span><span style="color:#808000">if</span><span style="color:#c0c0c0"> </span>(p_section)</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:#c0c0c0"> </span>{</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:#c0c0c0"> </span>uint8_t*<span style="color:#c0c0c0"> </span>p_byte;</pre>
<pre style="margin-top:0px;margin-bottom:0px"></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:#c0c0c0"> </span><span style="color:#808000">if</span><span style="color:#c0c0c0"> </span>(!dvbpsi_tot_section_valid(p_dvbpsi,<span style="color:#c0c0c0"> </span>p_section))</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:#c0c0c0"> </span><span style="color:#808000">return</span>;</pre>
<pre style="margin-top:0px;margin-bottom:0px"></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:#c0c0c0"> </span>p_byte<span style="color:#c0c0c0"> </span>=<span style="color:#c0c0c0"> </span>p_section->p_payload_start;</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:#c0c0c0"> </span><span style="color:#808000">if</span><span style="color:#c0c0c0"> </span>(p_byte<span style="color:#c0c0c0"> </span>+<span style="color:#c0c0c0"> </span><span style="color:#000080">5</span><span style="color:#c0c0c0"> </span><=<span style="color:#c0c0c0"> </span>p_section->p_payload_end)</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:#c0c0c0"> </span>{</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:#c0c0c0"> </span>p_tot-><span style="color:#800000">i_utc_time</span><span style="color:#c0c0c0"> </span>=<span style="color:#c0c0c0"> </span>((uint64_t)p_byte[<span style="color:#000080">0</span>]<span style="color:#c0c0c0"> </span><<<span style="color:#c0c0c0"> </span><span style="color:#000080">32</span>)<span style="color:#c0c0c0"> </span>|</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:#c0c0c0"> </span>((uint64_t)p_byte[<span style="color:#000080">1</span>]<span style="color:#c0c0c0"> </span><<<span style="color:#c0c0c0"> </span><span style="color:#000080">24</span>)<span style="color:#c0c0c0"> </span>|</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:#c0c0c0"> </span>((uint64_t)p_byte[<span style="color:#000080">2</span>]<span style="color:#c0c0c0"> </span><<<span style="color:#c0c0c0"> </span><span style="color:#000080">16</span>)<span style="color:#c0c0c0"> </span>|</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:#c0c0c0"> </span>((uint64_t)p_byte[<span style="color:#000080">3</span>]<span style="color:#c0c0c0"> </span><<<span style="color:#c0c0c0"> </span><span style="color:#000080">8</span>)<span style="color:#c0c0c0"> </span>|</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:#c0c0c0"> </span>(uint64_t)p_byte[<span style="color:#000080">4</span>];</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:#c0c0c0"> </span>}</pre>
<pre style="margin-top:0px;margin-bottom:0px"></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:#c0c0c0"> </span><span style="color:#008000">/*</span><span style="color:#c0c0c0"> </span><span style="color:#008000">If</span><span style="color:#c0c0c0"> </span><span style="color:#008000">we</span><span style="color:#c0c0c0"> </span><span style="color:#008000">have</span><span style="color:#c0c0c0"> </span><span style="color:#008000">a</span><span style="color:#c0c0c0"> </span><span style="color:#008000">TOT,</span><span style="color:#c0c0c0"> </span><span style="color:#008000">extract</span><span style="color:#c0c0c0"> </span><span style="color:#008000">the</span><span style="color:#c0c0c0"> </span><span style="color:#008000">descriptors</span><span style="color:#c0c0c0"> </span><span style="color:#008000">*/</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:#c0c0c0"> </span><span style="color:#808000">if</span><span style="color:#c0c0c0"> </span>(p_section->i_table_id<span style="color:#c0c0c0"> </span>==<span style="color:#c0c0c0"> </span><span style="color:#000080">0x73</span>)</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:#c0c0c0"> </span>{</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:#c0c0c0"> </span>uint8_t*<span style="color:#c0c0c0"> </span>p_end;</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:#c0c0c0"> </span>p_byte<span style="color:#c0c0c0"> </span>+=<span style="color:#c0c0c0"> </span><span style="color:#000080">7</span>;</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:#c0c0c0"> </span>p_end<span style="color:#c0c0c0"> </span>=<span style="color:#c0c0c0"> </span>p_byte<span style="color:#c0c0c0"> </span>+<span style="color:#c0c0c0"> </span>(<span style="color:#c0c0c0"> </span>((uint16_t)(p_section->p_payload_start[<span style="color:#000080">5</span>]<span style="color:#c0c0c0"> </span>&<span style="color:#c0c0c0"> </span><span style="color:#000080">0x0f</span>)<span style="color:#c0c0c0"> </span><<<span style="color:#c0c0c0"> </span><span style="color:#000080">8</span>)</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:#c0c0c0"> </span>|<span style="color:#c0c0c0"> </span>p_section->p_payload_start[<span style="color:#000080">6</span>]);</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:#c0c0c0"> </span><span style="color:#808000">while</span><span style="color:#c0c0c0"> </span>(p_byte+<span style="color:#000080">2</span><span style="color:#c0c0c0"> </span><=<span style="color:#c0c0c0"> </span>p_end)</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:#c0c0c0"> </span>{</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:#c0c0c0"> </span>uint8_t<span style="color:#c0c0c0"> </span>i_tag<span style="color:#c0c0c0"> </span>=<span style="color:#c0c0c0"> </span>p_byte[<span style="color:#000080">0</span>];</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:#c0c0c0"> </span>uint8_t<span style="color:#c0c0c0"> </span>i_length<span style="color:#c0c0c0"> </span>=<span style="color:#c0c0c0"> </span>p_byte[<span style="color:#000080">1</span>];</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:#c0c0c0"> </span><span style="color:#808000">if</span><span style="color:#c0c0c0"> </span>(i_length<span style="color:#c0c0c0"> </span>+<span style="color:#c0c0c0"> </span><span style="color:#000080">2</span><span style="color:#c0c0c0"> </span><=<span style="color:#c0c0c0"> </span>p_section->p_payload_end<span style="color:#c0c0c0"> </span>-<span style="color:#c0c0c0"> </span>p_byte)</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:#c0c0c0"> </span>dvbpsi_tot_descriptor_add(p_tot,<span style="color:#c0c0c0"> </span>i_tag,<span style="color:#c0c0c0"> </span>i_length,<span style="color:#c0c0c0"> </span>p_byte<span style="color:#c0c0c0"> </span>+<span style="color:#c0c0c0"> </span><span style="color:#000080">2</span>);</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:#c0c0c0"> </span>p_byte<span style="color:#c0c0c0"> </span>+=<span style="color:#c0c0c0"> </span><span style="color:#000080">2</span><span style="color:#c0c0c0"> </span>+<span style="color:#c0c0c0"> </span>i_length;</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:#c0c0c0"> </span>}</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:#c0c0c0"> </span>}</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:#c0c0c0"> </span>}</pre>
<pre style="margin-top:0px;margin-bottom:0px">}</pre>