[vlc-devel] [PATCH] dirac: Fix potential integer overflow

Hugo Beauzée-Luyssen hugo at beauzee.fr
Sun Nov 12 09:56:43 CET 2017


---
 modules/packetizer/dirac.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/modules/packetizer/dirac.c b/modules/packetizer/dirac.c
index 6e8d7c50ba..c760eff29f 100644
--- a/modules/packetizer/dirac.c
+++ b/modules/packetizer/dirac.c
@@ -481,8 +481,10 @@ static bool dirac_UnpackParseInfo( parse_info_t *p_pi, block_bytestream_t *p_bs,
         return false;
 
     p_pi->i_parse_code = p_d[4];
-    p_pi->u_next_offset = p_d[5] << 24 | p_d[6] << 16 | p_d[7] << 8 | p_d[8];
-    p_pi->u_prev_offset = p_d[9] << 24 | p_d[10] << 16 | p_d[11] << 8 | p_d[12];
+    p_pi->u_next_offset = (uint32_t)p_d[5] << 24 | (uint32_t)p_d[6] << 16 |
+                          (uint32_t)p_d[7] << 8 | p_d[8];
+    p_pi->u_prev_offset = (uint32_t)p_d[9] << 24 | (uint32_t)p_d[10] << 16 |
+                          (uint32_t)p_d[11] << 8 | p_d[12];
     return true;
 }
 
-- 
2.11.0



More information about the vlc-devel mailing list