[PATCH] EIT decoding

Roberto Corno <[email protected]>
Newsgroups gmane.comp.video.videolan.libdvbpsi.devel
Message-ID <CAO6YRm9PR6_r2gLnHVid9ZPjCan9kPWTRepDUyEd9W3s+dUFbw@mail.gmail.com>
Hi Jean Paul,
   last refactory introduced a bug in the EIT schedule decoding process.
The dvbpsi_decoder_sections_chain function that now is common to several
decoder does not check for ap_section being NULL (eit table could have gap
between section)
I have simply included an ad hoc dvbpsi_decoder_eit_sections_chain function
within the eit.c file because the bug seems to affect only eit decoding.
Patch is attached.
Best regards
Roberto

_______________________________________________
libdvbpsi-devel mailing list
[email protected]
http://mailman.videolan.org/listinfo/libdvbpsi-devel
0002-EI-schedule-decoding-SEGV-fix.patch (application/octet-stream, 1.9 KB)
From 8e863470dcd1f48af7d43acceb055056b4048e87 Mon Sep 17 00:00:00 2001
From: Roberto Corno <[email protected]>
Date: Wed, 1 Aug 2012 09:13:56 +0200
Subject: [PATCH 2/2] EI schedule decoding SEGV fix

---
 src/tables/eit.c |   24 +++++++++++++++++++++++-
 1 files changed, 23 insertions(+), 1 deletions(-)

diff --git a/src/tables/eit.c b/src/tables/eit.c
index bfc4a42..4ad64f7 100644
--- a/src/tables/eit.c
+++ b/src/tables/eit.c
@@ -395,6 +395,28 @@ static bool dvbpsi_AddSectionEIT(dvbpsi_t *p_dvbpsi, dvbpsi_eit_decoder_t *p_eit
     return true;
 }
 
+static void dvbpsi_decoder_eit_sections_chain(dvbpsi_decoder_t* p_eit_decoder)
+{
+    assert(p_eit_decoder);
+    assert(p_eit_decoder->i_last_section_number <= 255);
+
+    /* Chain the sections */
+    if(p_eit_decoder->i_last_section_number)
+    {
+      dvbpsi_psi_section_t * p_prev_section;
+
+      p_prev_section = p_eit_decoder->ap_sections[0];
+      for(unsigned int i = 1; i <= p_eit_decoder->i_last_section_number; i++)
+      {
+        if(p_eit_decoder->ap_sections[i] != NULL)
+        {
+          p_prev_section->p_next = p_eit_decoder->ap_sections[i];
+          p_prev_section = p_eit_decoder->ap_sections[i];
+        }
+      }
+    }
+
+}
 /*****************************************************************************
  * dvbpsi_eit_sections_gather
  *****************************************************************************
@@ -474,7 +496,7 @@ void dvbpsi_eit_sections_gather(dvbpsi_t *p_dvbpsi, dvbpsi_decoder_t *p_private_
         p_eit_decoder->b_current_valid = true;
 
         /* Chain the sections */
-        dvbpsi_decoder_sections_chain(DVBPSI_DECODER(p_eit_decoder));
+        dvbpsi_decoder_eit_sections_chain(DVBPSI_DECODER(p_eit_decoder));
 
         /* Decode the sections */
         dvbpsi_eit_sections_decode(p_eit_decoder->p_building_eit, p_eit_decoder->ap_sections[0]);
-- 
1.7.5.4
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.