[libdvbpsi-devel] Fix bad operator precedence when reading handover_type in dr-4a generation

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


libdvbpsi | branch: master | Daniel Kamil Kozar <dkk089 at gmail.com> | Sat Jul 18 21:49:53 2015 +0200| [b297e4d47c034f02de769f2011ef1791ba218031] | committer: Jean-Paul Saman

Fix bad operator precedence when reading handover_type in dr-4a generation

Due to the lack of parenthesis, the expression used to read handover_type was
read as (p_descriptor->p_data[7] & (0xF0 >> 4)).

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

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

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

diff --git a/src/descriptors/dr_4a.c b/src/descriptors/dr_4a.c
index e4d2b3e..f00e646 100644
--- a/src/descriptors/dr_4a.c
+++ b/src/descriptors/dr_4a.c
@@ -60,13 +60,13 @@ dvbpsi_linkage_dr_t* dvbpsi_DecodeLinkageDr(dvbpsi_descriptor_t * p_descriptor)
     if (p_descriptor->i_length < DR_4A_MIN_SIZE)
         return NULL;
     
-    int handover_type = 0, origin_type = 0;
+    unsigned int handover_type = 0, origin_type = 0;
     if (p_descriptor->p_data[6] == 0x08)
     {
         if (p_descriptor->i_length < DR_4A_MIN_SIZE + 1)
             return NULL;
         
-        handover_type = p_descriptor->p_data[7] & 0xF0 >> 4;
+        handover_type = (p_descriptor->p_data[7] & 0xF0) >> 4;
         origin_type = p_descriptor->p_data[7] & 0x01;
         if ((( handover_type > 0 ) && ( handover_type < 4 )
                 && ( origin_type == 0 ) && ( p_descriptor->i_length < DR_4A_MIN_SIZE + 5 )) ||



More information about the libdvbpsi-devel mailing list