[vlc-commits] demux/nsv: ignore unsupported blocks

Filip Roséen git at videolan.org
Wed Nov 16 14:27:42 CET 2016


vlc | branch: master | Filip Roséen <filip at atch.se> | Sun Nov  6 03:17:25 2016 +0100| [c36eb466f2f0012d582014d2731d47595872b327] | committer: Jean-Baptiste Kempf

demux/nsv: ignore unsupported blocks

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

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 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 36715c7..8ea084d 100644
--- a/modules/demux/nsv.c
+++ b/modules/demux/nsv.c
@@ -277,7 +277,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 );
+            }
         }
     }
 
@@ -305,7 +313,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 );
+            }
         }
     }
 



More information about the vlc-commits mailing list