[vlc-commits] codec: webvtt: fix infinite loop

Francois Cartegnie git at videolan.org
Tue Dec 12 11:46:46 CET 2017


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Tue Dec 12 11:38:51 2017 +0100| [12a5311d7c8ed2f68b47b18dbb52907317ca2ea8] | committer: Francois Cartegnie

codec: webvtt: fix infinite loop

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

 modules/codec/webvtt/subsvtt.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/modules/codec/webvtt/subsvtt.c b/modules/codec/webvtt/subsvtt.c
index ad1ff75257..83195a30ab 100644
--- a/modules/codec/webvtt/subsvtt.c
+++ b/modules/codec/webvtt/subsvtt.c
@@ -480,14 +480,13 @@ static bool webvtt_domnode_Match_Class( const webvtt_dom_node_t *p_node, const c
     if( p_node->type == NODE_TAG )
     {
         const webvtt_dom_tag_t *p_tagnode = (webvtt_dom_tag_t *) p_node;
-        while( p_tagnode->psz_attrs && psz )
+        for( const char *p = p_tagnode->psz_attrs; p && psz; p++ )
         {
-            const char *p = strstr( p_tagnode->psz_attrs, psz );
+            p = strstr( p, psz );
             if( !p )
                 return false;
-            if( p > psz && p[-1] == '.' && !isalnum(p[i_len]) )
+            if( p > p_tagnode->psz_attrs && p[-1] == '.' && !isalnum(p[i_len]) )
                 return true;
-            psz = p + 1;
         }
     }
     return false;



More information about the vlc-commits mailing list