[libdvbpsi-devel] Fix generation of the parental rating descriptor

Daniel Kamil Kozar git at videolan.org
Mon Aug 24 12:54:44 CEST 2015


libdvbpsi | branch: master | Daniel Kamil Kozar <dkk089 at gmail.com> | Sun Jul 19 01:18:54 2015 +0200| [d444eb83265f2522f42f7d7101514970d5928fb5] | committer: Jean-Paul Saman

Fix generation of the parental rating descriptor

Due to scaling the index variable by 8 instead of 4, the generation function of
the parental rating descriptor makes out-of-bounds array accesses.

(cherry picked from commit 0752d56b25f3b2724618de4cd50a11d0f9420af2)
Signed-off-by: Jean-Paul Saman <jpsaman at videolan.org>

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

 src/descriptors/dr_55.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/descriptors/dr_55.c b/src/descriptors/dr_55.c
index 6dd1a41..64a06e3 100644
--- a/src/descriptors/dr_55.c
+++ b/src/descriptors/dr_55.c
@@ -112,14 +112,14 @@ dvbpsi_descriptor_t * dvbpsi_GenParentalRatingDr(
     /* Encode data */
     for (int i = 0; i < p_decoded->i_ratings_number; i++ )
     {
-        p_descriptor->p_data[8 * i] =
+        p_descriptor->p_data[4 * i] =
                 p_decoded->p_parental_rating[i].i_country_code >> 16;
-        p_descriptor->p_data[8 * i + 1] =
+        p_descriptor->p_data[4 * i + 1] =
                 (p_decoded->p_parental_rating[i].i_country_code >> 8) & 0xff;
-        p_descriptor->p_data[8 * i + 2] =
+        p_descriptor->p_data[4 * i + 2] =
                 p_decoded->p_parental_rating[i].i_country_code & 0xff;
 
-        p_descriptor->p_data[8 * i + 3] =
+        p_descriptor->p_data[4 * i + 3] =
                 p_decoded->p_parental_rating[i].i_rating;
     }
 



More information about the libdvbpsi-devel mailing list