Hi all,<div>CAT decode function doesn't work very well in libpsisi 1.0.0, in fact</div><div>it may skip the last descriptor of the cat descriptor loop, according to its length. <br><div>the problem is that red highlighted +5 which is not necessary.</div>
<div><br></div><div><br></div><div><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(128,128,0)">void</span><span style="color:rgb(192,192,192)"> </span>dvbpsi_cat_sections_decode(<span style="color:rgb(128,0,128)">dvbpsi_cat_t</span>*<span style="color:rgb(192,192,192)"> </span>p_cat,<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">dvbpsi_psi_section_t</span>*<span style="color:rgb(192,192,192)"> </span>p_section)</pre>
<pre style="margin-top:0px;margin-bottom:0px">{</pre><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span>uint8_t*<span style="color:rgb(192,192,192)"> </span>p_byte;</pre><pre style="margin-top:0px;margin-bottom:0px">
<span style="color:rgb(192,192,192)">    </span><span style="color:rgb(128,128,0)">while</span><span style="color:rgb(192,192,192)"> </span>(p_section)</pre><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span>{</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span><span style="color:rgb(0,128,0)">/*</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">CAT</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">descriptors</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">*/</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><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>p_section->p_payload_start;</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span><span style="color:rgb(128,128,0)">while</span><span style="color:rgb(192,192,192)"> </span>(p_byte<span style="background-color:rgb(255,0,0)"> +5<span style="color:rgb(192,192,192)"> </span></span><=<span style="color:rgb(192,192,192)"> </span>p_section->p_payload_end)</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span>{</pre><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">            </span>uint8_t<span style="color:rgb(192,192,192)"> </span>i_tag<span style="color:rgb(192,192,192)"> </span>=<span style="color:rgb(192,192,192)"> </span>p_byte[<span style="color:rgb(0,0,128)">0</span>];</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">            </span>uint8_t<span style="color:rgb(192,192,192)"> </span>i_length<span style="color:rgb(192,192,192)"> </span>=<span style="color:rgb(192,192,192)"> </span>p_byte[<span style="color:rgb(0,0,128)">1</span>];</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">            </span><span style="color:rgb(128,128,0)">if</span><span style="color:rgb(192,192,192)"> </span>(i_length<span style="color:rgb(192,192,192)"> </span>+<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,128)">2</span><span style="color:rgb(192,192,192)"> </span><=<span style="color:rgb(192,192,192)"> </span>p_section->p_payload_end<span style="color:rgb(192,192,192)"> </span>-<span style="color:rgb(192,192,192)"> </span>p_byte)</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">                </span>dvbpsi_cat_descriptor_add(p_cat,<span style="color:rgb(192,192,192)"> </span>i_tag,<span style="color:rgb(192,192,192)"> </span>i_length,<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)">2</span>);</pre>
<pre style="margin-top:0px;margin-bottom:0px"><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)">2</span><span style="color:rgb(192,192,192)"> </span>+<span style="color:rgb(192,192,192)"> </span>i_length;</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span>}</pre><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span>p_section<span style="color:rgb(192,192,192)"> </span>=<span style="color:rgb(192,192,192)"> </span>p_section->p_next;</pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span>}</pre><pre style="margin-top:0px;margin-bottom:0px">}</pre></div></div>