[vlc-commits] m3u8: validate UTF-8 input

Rémi Denis-Courmont git at videolan.org
Sun Mar 25 17:49:42 CEST 2012


vlc/vlc-1.1 | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Mar 25 18:42:44 2012 +0300| [67e68953317138399925c5771d07b0fa8fcc4dbc] | committer: Rémi Denis-Courmont

m3u8: validate UTF-8 input

(cherry picked from commit 591633b76ae00810185c818fa4aaee7257291e9d)

> http://git.videolan.org/gitweb.cgi/vlc/vlc-1.1.git/?a=commit;h=67e68953317138399925c5771d07b0fa8fcc4dbc
---

 modules/demux/playlist/m3u.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/modules/demux/playlist/m3u.c b/modules/demux/playlist/m3u.c
index b29e654..728f977 100644
--- a/modules/demux/playlist/m3u.c
+++ b/modules/demux/playlist/m3u.c
@@ -55,6 +55,11 @@ static char *GuessEncoding (const char *str)
     return IsUTF8 (str) ? strdup (str) : FromLatin1 (str);
 }
 
+static char *CheckUnicode (const char *str)
+{
+    return IsUTF8 (str) ? strdup (str): NULL;
+}
+
 /*****************************************************************************
  * Import_M3U: main import function
  *****************************************************************************/
@@ -68,7 +73,7 @@ int Import_M3U( vlc_object_t *p_this )
     if( POKE( p_peek, "RTSPtext", 8 ) /* QuickTime */
      || demux_IsPathExtension( p_demux, ".m3u8" )
      || demux_IsForced( p_demux, "m3u8" ) )
-        pf_dup = strdup; /* UTF-8 */
+        pf_dup = CheckUnicode; /* UTF-8 */
     else
     if( POKE( p_peek, "#EXTM3U", 7 )
      || demux_IsPathExtension( p_demux, ".m3u" )



More information about the vlc-commits mailing list