[libdvbpsi-devel] dr_55.c: Fix CID #17250

Jean-Paul Saman git at videolan.org
Thu Jun 4 10:02:03 CEST 2015


libdvbpsi | branch: master | Jean-Paul Saman <jean-paul.saman at m2x.nl> | Wed Dec 24 13:25:47 2014 +0100| [752b3e289be2954a61970fb815cad5828eae51e9] | committer: Jean-Paul Saman

dr_55.c: Fix CID #17250

> http://git.videolan.org/gitweb.cgi/libdvbpsi.git/?a=commit;h=752b3e289be2954a61970fb815cad5828eae51e9
---

 src/descriptors/dr_55.c |   12 +++++++++---
 src/descriptors/dr_56.h |    2 +-
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/src/descriptors/dr_55.c b/src/descriptors/dr_55.c
index 3089cdd..6dd1a41 100644
--- a/src/descriptors/dr_55.c
+++ b/src/descriptors/dr_55.c
@@ -92,13 +92,19 @@ dvbpsi_parental_rating_dr_t * dvbpsi_DecodeParentalRatingDr(
 dvbpsi_descriptor_t * dvbpsi_GenParentalRatingDr(
                                         dvbpsi_parental_rating_dr_t * p_decoded,
                                         bool b_duplicate)
-{    
-    if (p_decoded->i_ratings_number > DVBPSI_PARENTAL_RATING_DR_MAX)
+{
+    uint8_t i_length;
+    if (p_decoded->i_ratings_number >= DVBPSI_PARENTAL_RATING_DR_MAX)
+    {
+        i_length = (DVBPSI_PARENTAL_RATING_DR_MAX - 1) * 4;
         p_decoded->i_ratings_number = DVBPSI_PARENTAL_RATING_DR_MAX;
+    }
+    else
+        i_length = p_decoded->i_ratings_number * 4;
 
     /* Create the descriptor */
     dvbpsi_descriptor_t * p_descriptor =
-            dvbpsi_NewDescriptor(0x55, p_decoded->i_ratings_number * 4 , NULL);
+            dvbpsi_NewDescriptor(0x55, i_length, NULL);
 
     if (!p_descriptor)
         return NULL;
diff --git a/src/descriptors/dr_56.h b/src/descriptors/dr_56.h
index f50b65e..1ece3a9 100644
--- a/src/descriptors/dr_56.h
+++ b/src/descriptors/dr_56.h
@@ -67,7 +67,7 @@ typedef struct dvbpsi_teletextpage_s
  * \brief Maximum number of dvbpsi_teletextpage_t entries present in
  * @see dvbpsi_teletext_dr_t
  */
-#define DVBPSI_TELETEXT_DR_MAX 64
+#define DVBPSI_TELETEXT_DR_MAX 51
 
 /*****************************************************************************
  * dvbpsi_teletext_dr_t



More information about the libdvbpsi-devel mailing list