[vlc-commits] demux/ttml: fix crash on unexpected data

Filip Roséen git at videolan.org
Tue Sep 20 00:59:19 CEST 2016


vlc | branch: master | Filip Roséen <filip at atch.se> | Mon Sep 19 23:53:38 2016 +0200| [9f1fcb3b9e26f851228fd9e8d8a9e5d3490de78e] | committer: Hugo Beauzée-Luyssen

demux/ttml: fix crash on unexpected data

The previous implementation would crash if no relevant element was
found to populate the node hierarchy. These changes make sure that the
implementation does not try to move up the node hierarchy if we are
already at the top.

fixes #17402

Signed-off-by: Hugo Beauzée-Luyssen <hugo at beauzee.fr>

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

 modules/demux/ttml.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/modules/demux/ttml.c b/modules/demux/ttml.c
index e100826..66638b0 100644
--- a/modules/demux/ttml.c
+++ b/modules/demux/ttml.c
@@ -719,9 +719,12 @@ static int ReadTTML( demux_t* p_demux )
         /*  end tag after a p tag but inside the body */
         else if( i_type == XML_READER_ENDELEM && CompareTagName( psz_node_name, "body" ) )
         {
-            node_t* p_parent = p_parent_node->p_parent;
-            ClearNode( p_parent_node );
-            p_parent_node = p_parent;
+            if( p_parent_node )
+            {
+                node_t* p_parent = p_parent_node->p_parent;
+                ClearNode( p_parent_node );
+                p_parent_node = p_parent;
+            }
         }
     } while( i_type != XML_READER_ENDELEM || CompareTagName( psz_node_name, "tt" ) );
     ClearNodeStack( p_parent_node );



More information about the vlc-commits mailing list