[vlc-commits] packetizer: h264: fix early fail condition

Francois Cartegnie git at videolan.org
Sun Dec 6 15:03:38 CET 2015


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Sun Dec  6 15:02:13 2015 +0100| [c4cd717e90ce00f7c65aa6f07f0215768247f64f] | committer: Francois Cartegnie

packetizer: h264: fix early fail condition

sps id can obviously never be negative

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

 modules/packetizer/h264_nal.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/modules/packetizer/h264_nal.c b/modules/packetizer/h264_nal.c
index d5b04ae..57f69a7 100644
--- a/modules/packetizer/h264_nal.c
+++ b/modules/packetizer/h264_nal.c
@@ -427,6 +427,8 @@ int h264_parse_sps( const uint8_t *p_sps_buf, int i_sps_size,
     memset( p_sps, 0, sizeof(struct nal_sps) );
     CreateRbspFromNAL( &pb_dec, &i_dec, &p_sps_buf[5],
                       i_sps_size - 5 );
+    if( !pb_dec )
+        return -1;
 
     bs_init( &s, pb_dec, i_dec );
     int i_profile_idc = bs_read( &s, 8 );
@@ -435,7 +437,7 @@ int h264_parse_sps( const uint8_t *p_sps_buf, int i_sps_size,
     p_sps->i_level = bs_read( &s, 8 );
     /* sps id */
     p_sps->i_id = bs_read_ue( &s );
-    if( p_sps->i_id >= SPS_MAX || p_sps->i_id < 0 )
+    if( p_sps->i_id >= SPS_MAX )
     {
         free( pb_dec );
         return -1;



More information about the vlc-commits mailing list