[vlc-commits] [Git][videolan/vlc][master] mux: ts: fix null deref

François Cartegnie (@fcartegnie) gitlab at videolan.org
Sat Dec 23 11:30:41 UTC 2023



François Cartegnie pushed to branch master at VideoLAN / VLC


Commits:
50c3fc63 by François Cartegnie at 2023-12-23T11:09:52+00:00
mux: ts: fix null deref

is null due to callback..
regression by 811b77c304046b4b39ee614f57bd75029e2e4385

- - - - -


1 changed file:

- modules/mux/mpeg/ts.c


Changes:

=====================================
modules/mux/mpeg/ts.c
=====================================
@@ -458,26 +458,31 @@ static void GetPMT( sout_mux_t *p_mux, sout_buffer_chain_t *c );
 static block_t *TSNew( sout_mux_t *p_mux, sout_input_sys_t *p_stream, bool b_pcr );
 static void TSSetPCR( block_t *p_ts, vlc_tick_t i_dts );
 
-static csa_t *csaSetup( vlc_object_t *p_this )
+static void csaSetup( vlc_object_t *p_this )
 {
     sout_mux_t *p_mux = (sout_mux_t*)p_this;
     sout_mux_sys_t *p_sys = p_mux->p_sys;
     char *csack = var_CreateGetNonEmptyStringCommand( p_mux, SOUT_CFG_PREFIX "csa-ck" );
     if( !csack )
-        return NULL;
+        return;
 
     csa_t *csa = csa_New();
 
     if( unlikely(csa == NULL) )
-        return NULL;
+    {
+        free(csack);
+        return;
+    }
 
     if( csa_SetCW( p_this, csa, csack, true ) )
     {
         free(csack);
         csa_Delete( csa );
-        return NULL;
+        return;
     }
 
+    p_sys->csa = csa;
+
     vlc_mutex_init( &p_sys->csa_lock );
     p_sys->b_crypt_audio = var_GetBool( p_mux, SOUT_CFG_PREFIX "crypt-audio" );
     p_sys->b_crypt_video = var_GetBool( p_mux, SOUT_CFG_PREFIX "crypt-video" );
@@ -509,8 +514,6 @@ static csa_t *csaSetup( vlc_object_t *p_this )
     msg_Dbg( p_mux, "encrypting %d bytes of packet", p_sys->i_csa_pkt_size );
 
     free(csack);
-
-    return csa;
 }
 
 /*****************************************************************************
@@ -701,7 +704,7 @@ static int Open( vlc_object_t *p_this )
 
     p_mux->p_sys        = p_sys;
 
-    p_sys->csa = csaSetup(p_this);
+    csaSetup( p_this );
 
     p_mux->pf_control   = Control;
     p_mux->pf_addstream = AddStream;



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/50c3fc636aef9b95c78644e726ebc724c213305c

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/50c3fc636aef9b95c78644e726ebc724c213305c
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list