[vlc-commits] mod: validate meta data (fixes #9206)

Rémi Denis-Courmont git at videolan.org
Sat Aug 17 21:18:50 CEST 2013


vlc/vlc-2.1 | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Aug 17 22:15:54 2013 +0300| [dab24e8b9af71a30e304d57cbd419ab2fa519006] | committer: Rémi Denis-Courmont

mod: validate meta data (fixes #9206)

It might be better to convert from the proper character encoding to
UTF-8, but I do not know what proper is.

(cherry picked from commit 80e9517463eeab48be8adac970428fcfbbc995e1)

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

 modules/demux/mod.c |    9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/modules/demux/mod.c b/modules/demux/mod.c
index aa4adef..48c9ec0 100644
--- a/modules/demux/mod.c
+++ b/modules/demux/mod.c
@@ -34,6 +34,7 @@
 #include <vlc_plugin.h>
 #include <vlc_demux.h>
 #include <vlc_meta.h>
+#include <vlc_charset.h>
 #include <assert.h>
 
 #include <libmodplug/modplug.h>
@@ -368,12 +369,12 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
         char *psz_module_info, *psz_instrument_info;
         unsigned i_temp_index = 0;
         const char *psz_name = ModPlug_GetName( p_sys->f );
-        if( psz_name && *psz_name )
+        if( psz_name && *psz_name && IsUTF8( psz_name ) )
             vlc_meta_SetTitle( p_meta, psz_name );
 
         /* Comment field from artist - not in every type of MOD */
         psz_name = ModPlug_GetMessage( p_sys->f );
-        if( psz_name && *psz_name )
+        if( psz_name && *psz_name && IsUTF8( psz_name ) )
             vlc_meta_SetDescription( p_meta, psz_name );
 
         /* Instruments only in newer MODs - so don't show if 0 */
@@ -402,7 +403,7 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
             {
                 char lBuffer[33];
                 ModPlug_InstrumentName( p_sys->f, i, lBuffer );
-                if ( !lBuffer[0] ) continue; // don't add empty fields.
+                if ( !lBuffer[0] || !IsUTF8( lBuffer ) ) continue;
                 i_temp_index += snprintf( &psz_temp[i_temp_index], sizeof(psz_temp) - i_temp_index, "%s\n", lBuffer );
             }
 
@@ -414,7 +415,7 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
         {
             char psz_buffer[33];
             ModPlug_SampleName( p_sys->f, i, psz_buffer );
-            if ( !psz_buffer[0] ) continue; // don't add empty fields.
+            if ( !psz_buffer[0] || !IsUTF8( psz_buffer ) ) continue;
             i_temp_index += snprintf( &psz_temp[i_temp_index], sizeof(psz_temp) - i_temp_index, "%s\n", psz_buffer );
         }
 



More information about the vlc-commits mailing list