[vlc-devel] [PATCH 2/2] asx: remove useless test

Pierre Lamot pierre at videolabs.io
Mon Dec 11 10:22:45 CET 2017


---
 modules/demux/playlist/asx.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/modules/demux/playlist/asx.c b/modules/demux/playlist/asx.c
index 0c0614cec7..c4d7170013 100644
--- a/modules/demux/playlist/asx.c
+++ b/modules/demux/playlist/asx.c
@@ -356,16 +356,17 @@ end:
 /// this looks for patterns like &name; &#DEC; or &#xHEX;
 static bool isXmlEncoded(const char* psz_str)
 {
+    assert( psz_str != NULL );
     //look for special characters
     if( strpbrk(psz_str, "<>'\"") != NULL )
         return false;
 
     bool is_escaped = false;
-    while (psz_str != NULL)
+    while( true )
     {
         const char* psz_amp = strchr(psz_str, '&');
         if( psz_amp == NULL )
-            return is_escaped;
+            break;
         const char* psz_end = strchr(psz_amp, ';');
         if(  psz_end == NULL )
             return false;
@@ -414,6 +415,9 @@ static void memstream_puts_xmlencoded(struct vlc_memstream* p_stream, const char
     else
         psz_tmp = strndup( psz_begin, psz_end - psz_begin );
 
+    if ( psz_tmp == NULL )
+        return;
+
     if( isXmlEncoded( psz_tmp ) )
         vlc_memstream_puts( p_stream, psz_tmp );
     else
-- 
2.14.1



More information about the vlc-devel mailing list