[vlc-commits] codec: ttml: fix null dereference on styleless text
Francois Cartegnie
git at videolan.org
Tue Jan 10 14:33:57 CET 2017
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Tue Jan 10 14:33:16 2017 +0100| [265e967051250bb58512733fe5a981b283a0fd0a] | committer: Francois Cartegnie
codec: ttml: fix null dereference on styleless text
shit happens
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=265e967051250bb58512733fe5a981b283a0fd0a
---
modules/codec/ttml/substtml.c | 29 ++++++++++++++++-------------
1 file changed, 16 insertions(+), 13 deletions(-)
diff --git a/modules/codec/ttml/substtml.c b/modules/codec/ttml/substtml.c
index b2bf575..e880b27 100644
--- a/modules/codec/ttml/substtml.c
+++ b/modules/codec/ttml/substtml.c
@@ -517,19 +517,22 @@ static text_segment_t * ConvertNodesToSegments( ttml_context_t *p_ctx, const tt_
const tt_textnode_t *p_ttnode = (const tt_textnode_t *) p_child;
*pp_last = text_segment_New( p_ttnode->psz_text );
ttml_style_t *s = InheritTTMLStyles( p_ctx, p_child->p_parent );
- (*pp_last)->style = s->font_style;
- s->font_style = NULL;
- if( !s->b_preserve_space )
- StripSpacing( *pp_last );
- if( s->b_direction_set )
- BIDIConvert( *pp_last, s->i_direction );
- /* FIXME: This is carried from broken prev code feat
- * as there can be multiple regions. Return first ttml style
- * to apply to default SPU region for now */
- if( *pp_ret_ttml_style == NULL )
- *pp_ret_ttml_style = s;
- else
- ttml_style_Delete( s );
+ if( s )
+ {
+ (*pp_last)->style = s->font_style;
+ s->font_style = NULL;
+ if( !s->b_preserve_space )
+ StripSpacing( *pp_last );
+ if( s->b_direction_set )
+ BIDIConvert( *pp_last, s->i_direction );
+ /* FIXME: This is carried from broken prev code feat
+ * as there can be multiple regions. Return first ttml style
+ * to apply to default SPU region for now */
+ if( *pp_ret_ttml_style == NULL )
+ *pp_ret_ttml_style = s;
+ else
+ ttml_style_Delete( s );
+ }
}
else
{
More information about the vlc-commits
mailing list