[vlc-commits] packetizer: h264: fix trailing junk on cc extraction

Francois Cartegnie git at videolan.org
Mon Oct 3 13:42:57 CEST 2016


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Mon Oct  3 12:10:12 2016 +0200| [3ab155c94beb815beb01785838ea64c14d8cb5fb] | committer: Francois Cartegnie

packetizer: h264: fix trailing junk on cc extraction

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=3ab155c94beb815beb01785838ea64c14d8cb5fb
---

 modules/packetizer/h264.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/modules/packetizer/h264.c b/modules/packetizer/h264.c
index 2b6f097..fcee9bf 100644
--- a/modules/packetizer/h264.c
+++ b/modules/packetizer/h264.c
@@ -1026,12 +1026,13 @@ static void ParseSei( decoder_t *p_dec, block_t *p_frag )
                     0x03  /* Captions */
                 };
 
-                const unsigned i_t35 = i_size;
-                uint8_t *p_t35 = malloc( i_t35 );
+                unsigned i_t35;
+                uint8_t *p_t35 = malloc( i_size );
                 if( !p_t35 )
                     break;
-                for( unsigned i=0; i<i_t35; i++ )
-                    p_t35[i] = bs_read( &s, 8 );
+
+                for( i_t35 = 0; i_t35<i_size && bs_remain( &s ) >= 8; i_t35++ )
+                    p_t35[i_t35] = bs_read( &s, 8 );
 
                 /* Check for we have DVB1_data() */
                 if( i_t35 >= sizeof(p_DVB1_data_start_code) &&



More information about the vlc-commits mailing list