[vlc-devel] [PATCH 3/3] demux/nsv: fix 17571: ignore unsupported blocks

Filip Roséen filip at atch.se
Sun Nov 6 03:17:25 CET 2016


The previous implementation would crash given that p_sys->p_video and
p_sys->p_audio is not guaranteed to be non-NULL (they can be NULL due
to an unsupported codec).

These changes simply make sure that we do not try to send blocks that
do not have have a corresponding ES (causing a crash).

fixes #17571
---
 modules/demux/nsv.c | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/modules/demux/nsv.c b/modules/demux/nsv.c
index ef4ff44a..8676ade 100644
--- a/modules/demux/nsv.c
+++ b/modules/demux/nsv.c
@@ -278,7 +278,15 @@ static int Demux( demux_t *p_demux )
         if( i_size > 0 && ( p_frame = vlc_stream_Block( p_demux->s, i_size ) ) )
         {
             p_frame->i_dts = VLC_TS_0 + p_sys->i_pcr;
-            es_out_Send( p_demux->out, p_sys->p_video, p_frame );
+
+            if( p_sys->p_video )
+                es_out_Send( p_demux->out, p_sys->p_video, p_frame );
+            else
+            {
+                block_Release( p_frame );
+                msg_Dbg( p_demux, "ignoring unsupported video frame (size=%d)",
+                         i_size );
+            }
         }
     }
 
@@ -306,7 +314,15 @@ static int Demux( demux_t *p_demux )
         {
             p_frame->i_dts =
             p_frame->i_pts = VLC_TS_0 + p_sys->i_pcr;
-            es_out_Send( p_demux->out, p_sys->p_audio, p_frame );
+
+            if( p_sys->p_audio )
+                es_out_Send( p_demux->out, p_sys->p_audio, p_frame );
+            else
+            {
+                block_Release( p_frame );
+                msg_Dbg( p_demux, "ignoring unsupported audio frame (size=%d)",
+                         i_size );
+            }
         }
     }
 
-- 
2.10.2



More information about the vlc-devel mailing list