[vlc-commits] demux: webvtt: fix set_time null deref with no valid cues (fix #22448)

Francois Cartegnie git at videolan.org
Wed Jun 19 18:04:45 CEST 2019


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Wed Jun 19 18:00:11 2019 +0200| [13408f65758f3bfb11761535df8e44c4c28e04d4] | committer: Francois Cartegnie

demux: webvtt: fix set_time null deref with no valid cues (fix #22448)

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

 modules/demux/webvtt.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/modules/demux/webvtt.c b/modules/demux/webvtt.c
index 23c5e36d66..e60f9a6c45 100644
--- a/modules/demux/webvtt.c
+++ b/modules/demux/webvtt.c
@@ -438,12 +438,16 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
             return VLC_SUCCESS;
 
         case DEMUX_SET_TIME:
-            p_sys->index.i_current = getIndexByTime( p_sys, va_arg( args, vlc_tick_t ) );
-            p_sys->b_first_time = true;
-            p_sys->i_next_demux_time =
-                    p_sys->index.p_array[p_sys->index.i_current].time;
-            p_sys->i_next_block_flags |= BLOCK_FLAG_DISCONTINUITY;
-            return VLC_SUCCESS;
+            if( p_sys->cues.i_count )
+            {
+                p_sys->index.i_current = getIndexByTime( p_sys, va_arg( args, vlc_tick_t ) );
+                p_sys->b_first_time = true;
+                p_sys->i_next_demux_time =
+                        p_sys->index.p_array[p_sys->index.i_current].time;
+                p_sys->i_next_block_flags |= BLOCK_FLAG_DISCONTINUITY;
+                return VLC_SUCCESS;
+            }
+            break;
 
         case DEMUX_GET_POSITION:
             pf = va_arg( args, double * );



More information about the vlc-commits mailing list