Hi,<div><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.727272033691406px;background-color:rgb(255,255,255)">NIT and BAT table already start at the right location </span></div><div><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.727272033691406px;background-color:rgb(255,255,255)">but the problem with them </span><span style="color:rgb(34,34,34);font-family:arial,sans-serif">is</span><span style="color:rgb(34,34,34);font-family:arial,sans-serif"> (</span><span style="background-color:rgb(255,255,255);color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.727272033691406px">as pointed out in the patch)</span></div>
<div><font color="#222222" face="arial, sans-serif">with the calculation of p_end which needs a +2 otherwise</font></div><div><font color="#222222" face="arial, sans-serif">decoder may miss last descriptor in the loop.</font></div>
<div><font color="#222222" face="arial, sans-serif">attached the patch against last commit.</font></div><div><font color="#222222" face="arial, sans-serif">thanks</font></div><div><font color="#222222" face="arial, sans-serif"><br>
</font></div><div><font color="#222222" face="arial, sans-serif"><br></font></div><div><font color="#222222" face="arial, sans-serif"><br></font></div><div><font color="#222222" face="arial, sans-serif"><br></font></div><div>
<font color="#222222" face="arial, sans-serif"><br></font></div><div><font color="#222222" face="arial, sans-serif"><br></font></div><div><font color="#222222" face="arial, sans-serif"><div>From 4dbf8cf04b0e1f38743f08c0d14416fe77e7cd05 Mon Sep 17 00:00:00 2001</div>
<div>From: Angelo Schiavone <<a href="mailto:angelo.schiavone@screen.it">angelo.schiavone@screen.it</a>></div><div>Date: Thu, 24 Jan 2013 08:52:11 +0100</div><div>Subject: [PATCH] fixes NIT and BAT descriptors loop decoding, p_end is now</div>
<div> correctly calculated</div><div><br></div><div>---</div><div> src/tables/bat.c | 2 +-</div><div> src/tables/nit.c | 2 +-</div><div> 2 files changed, 2 insertions(+), 2 deletions(-)</div><div><br></div><div>diff --git a/src/tables/bat.c b/src/tables/bat.c</div>
<div>index 9811795..efda516 100644</div><div>--- a/src/tables/bat.c</div><div>+++ b/src/tables/bat.c</div><div>@@ -489,7 +489,7 @@ void dvbpsi_bat_sections_decode(dvbpsi_bat_t* p_bat,</div><div> p_byte += 2 + i_length;</div>
<div> }</div><div> </div><div>- p_end = p_byte + (((uint16_t)(p_byte[0] & 0x0f) << 8)</div><div>+ p_end = 2 + p_byte + (((uint16_t)(p_byte[0] & 0x0f) << 8)</div><div> | p_byte[1]);</div>
<div> if (p_end > p_section->p_payload_end)</div><div> p_end = p_section->p_payload_end;</div><div>diff --git a/src/tables/nit.c b/src/tables/nit.c</div><div>index 1532e3d..dce830e 100644</div>
<div>--- a/src/tables/nit.c</div><div>+++ b/src/tables/nit.c</div><div>@@ -474,7 +474,7 @@ void dvbpsi_nit_sections_decode(dvbpsi_nit_t* p_nit,</div><div> }</div><div> </div><div> /* Transport stream loop length */</div>
<div>- p_end = p_byte + (((uint16_t)(p_byte[0] & 0x0f) << 8)</div><div>+ p_end = 2 + p_byte + (((uint16_t)(p_byte[0] & 0x0f) << 8)</div><div> | p_byte[1]);</div>
<div> if (p_end > p_section->p_payload_end)</div><div> p_end = p_section->p_payload_end;</div><div>-- </div><div>1.7.9.5</div></font></div><div><font color="#222222" face="arial, sans-serif"><br>
</font></div><div><font color="#222222" face="arial, sans-serif"><br></font><br><div class="gmail_quote">2013/1/23 Jean-Paul Saman <span dir="ltr"><<a href="mailto:jpsaman@videolan.org" target="_blank">jpsaman@videolan.org</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Oops pressed send too soon.<br><div><div dir="ltr"><div class="gmail_extra"><br><br><div class="gmail_quote">
<div><div class="h5">On Wed, Jan 23, 2013 at 8:22 PM, Jean-Paul Saman <span dir="ltr"><<a href="mailto:jpsaman@videolan.org" target="_blank">jpsaman@videolan.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Angelo,<br><div><div class="gmail_extra"><br></div><div class="gmail_extra"><div class="gmail_quote"><div>
On Wed, Jan 23, 2013 at 3:16 PM, Angelo Schiavone <span dir="ltr"><<a href="mailto:angelo.schiavone@gmail.com" target="_blank">angelo.schiavone@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">here is the git patch.</blockquote></div><div><br>In the end I did not use your patches to fix the issues. I just pushed changes that should fix all<br>
the bugs you noticed. It does need some wider testing so please try it ;)<br><br></div><div>If you find any issue, then please report them again.<br></div><div><br></div><div>Some feedback on your patch:<br></div><div>- both NIT and BAT table already start at the right location since p_byte is defined as:<br>
</div></div></div></div></div></blockquote><div><br></div></div></div><div>p_byte = p_section->p_playload_start + 2;<br> <br></div><div> - the other change in BAT table was correctly spotted<br></div><div> - you were right about the CAT table<br>
</div><div> - the CRC32 validation for TOT table has been solved in another way.<br><br></div></div>Kind regards,<br>Jean-Paul Saman<br></div></div></div></div>
</blockquote></div><br></div>