[vlc-commits] demux: ttml: fix endless loops on broken charset

Francois Cartegnie git at videolan.org
Wed Oct 7 20:44:09 CEST 2015


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Wed Oct  7 20:42:45 2015 +0200| [52ae2e38173d860123293f4c084f2c2d3423a0b8] | committer: Francois Cartegnie

demux: ttml: fix endless loops on broken charset

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

 modules/demux/ttml.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/modules/demux/ttml.c b/modules/demux/ttml.c
index d07f698..e671bd4 100644
--- a/modules/demux/ttml.c
+++ b/modules/demux/ttml.c
@@ -209,6 +209,8 @@ static int ReadTTML( demux_t* p_demux )
     do
     {
         i_type = xml_ReaderNextNode( p_sys->p_reader, &psz_name );
+        if( i_type <= XML_READER_NONE )
+            break;
 
         if ( i_type == XML_READER_STARTELEM && ( !strcasecmp( psz_name, "head" ) || !strcasecmp( psz_name, "tt:head" ) ) )
         {
@@ -271,7 +273,9 @@ static int ReadTTML( demux_t* p_demux )
 
                 i_type = xml_ReaderNextNode( p_sys->p_reader, &psz_name );
 
-                while ( i_type != XML_READER_ENDELEM || ( strcmp( psz_name, "p" ) && strcmp( psz_name, "tt:p" ) ) )
+                while ( i_type > XML_READER_NONE && ( i_type != XML_READER_ENDELEM
+                        || ( strcmp( psz_name, "p" ) && strcmp( psz_name, "tt:p" ) ) )
+                      )
                 {
                     if ( i_type == XML_READER_TEXT && psz_name != NULL )
                     {



More information about the vlc-commits mailing list