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

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


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

m3u8: validate UTF-8 input

(cherry picked from commit 591633b76ae00810185c818fa4aaee7257291e9d)

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

 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 5c34aa3..bb6a88c 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