[vlc-devel] [PATCH] modules/packetizer/dirac.c: check index before dereferencing

Nickolai Zeldovich nickolai at csail.mit.edu
Sun Jan 6 00:03:45 CET 2013


Check that frame_rate_index is within bounds before dereferencing
the dirac_frate_tbl[] array.
---
 modules/packetizer/dirac.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/modules/packetizer/dirac.c b/modules/packetizer/dirac.c
index 9f27185..04ec28a 100644
--- a/modules/packetizer/dirac.c
+++ b/modules/packetizer/dirac.c
@@ -571,13 +571,13 @@ static bool dirac_UnpackSeqHdr( struct seq_hdr_t *p_sh, block_t *p_block )
     if( dirac_bool( &bs ) )
     {
         uint32_t frame_rate_index = dirac_uint( &bs );
-        p_sh->u_fps_num = dirac_frate_tbl[frame_rate_index].u_n;
-        p_sh->u_fps_den = dirac_frate_tbl[frame_rate_index].u_d;
         if( frame_rate_index >= dirac_frate_tbl_size )
         {
             /* invalid header */
             return false;
         }
+        p_sh->u_fps_num = dirac_frate_tbl[frame_rate_index].u_n;
+        p_sh->u_fps_den = dirac_frate_tbl[frame_rate_index].u_d;
         if( frame_rate_index == 0 )
         {
             p_sh->u_fps_num = dirac_uint( &bs ); /* frame_rate_numerator */
-- 
1.7.10.4




More information about the vlc-devel mailing list