[vlc-commits] codec: webvtt: missing callback call
Francois Cartegnie
git at videolan.org
Fri Nov 3 17:46:48 CET 2017
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Fri Nov 3 12:58:56 2017 +0100| [5f120acfb3f1fb33050ca30d441bd5d9b24cfe05] | committer: Francois Cartegnie
codec: webvtt: missing callback call
and leak on invalid cue
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=5f120acfb3f1fb33050ca30d441bd5d9b24cfe05
---
modules/codec/webvtt/webvtt.c | 7 ++++++-
modules/demux/webvtt.c | 13 +++++++++++++
2 files changed, 19 insertions(+), 1 deletion(-)
diff --git a/modules/codec/webvtt/webvtt.c b/modules/codec/webvtt/webvtt.c
index ef3c7eecc0..dda86edaa9 100644
--- a/modules/codec/webvtt/webvtt.c
+++ b/modules/codec/webvtt/webvtt.c
@@ -204,7 +204,12 @@ void webvtt_text_parser_Feed( webvtt_text_parser_t *p, char *psz_line )
{
if( psz_line[0] == 0 )
{
- p->p_cue = NULL;
+ if( p->p_cue )
+ {
+ if( p->pf_cue_done )
+ p->pf_cue_done( p->priv, p->p_cue );
+ p->p_cue = NULL;
+ }
}
else
{
diff --git a/modules/demux/webvtt.c b/modules/demux/webvtt.c
index 990c3f0eba..3f95b57187 100644
--- a/modules/demux/webvtt.c
+++ b/modules/demux/webvtt.c
@@ -180,6 +180,13 @@ static webvtt_cue_t * ParserGetCueHandler( void *priv )
{
struct callback_ctx *ctx = (struct callback_ctx *) priv;
demux_sys_t *p_sys = ctx->p_demux->p_sys;
+ /* invalid recycled cue */
+ if( p_sys->cues.i_count &&
+ p_sys->cues.p_array[p_sys->cues.i_count - 1].psz_text == NULL )
+ {
+ return &p_sys->cues.p_array[p_sys->cues.i_count - 1];
+ }
+
if( p_sys->cues.i_alloc <= p_sys->cues.i_count )
{
webvtt_cue_t *p_realloc = realloc( p_sys->cues.p_array,
@@ -201,6 +208,12 @@ static void ParserCueDoneHandler( void *priv, webvtt_cue_t *p_cue )
{
struct callback_ctx *ctx = (struct callback_ctx *) priv;
demux_sys_t *p_sys = ctx->p_demux->p_sys;
+ if( p_cue->psz_text == NULL )
+ {
+ webvtt_cue_Clean( p_cue );
+ webvtt_cue_Init( p_cue );
+ return;
+ }
if( p_cue->i_stop > p_sys->i_length )
p_sys->i_length = p_cue->i_stop;
if( p_sys->cues.i_count > 0 &&
More information about the vlc-commits
mailing list