]> git.sesse.net Git - vlc/blobdiff - modules/meta_engine/taglib.cpp
AVI: fix potential crash on seek (Closes: LP#803006)
[vlc] / modules / meta_engine / taglib.cpp
index 81389f939d5e14c34a8bbf100af0bd0a429f9e26..d5e9e1cdb9c479fce00a52272127383c3b3be612 100644 (file)
@@ -72,6 +72,8 @@
 # define TAGLIB_HAVE_AIFF_WAV_H
 # include <aifffile.h>
 # include <wavfile.h>
+#else
+# include <id3v2tag.h>
 #endif
 
 #if TAGLIB_VERSION >= VERSION_INT(1,6,1) && defined(TAGLIB_WITH_MP4)
@@ -447,14 +449,14 @@ static int ReadMeta( vlc_object_t* p_this)
         return VLC_ENOMEM;
 
 #if defined(WIN32) || defined (UNDER_CE)
-    wchar_t wpath[MAX_PATH + 1];
-    if( !MultiByteToWideChar( CP_UTF8, 0, psz_path, -1, wpath, MAX_PATH) )
+    wchar_t *wpath = ToWide( psz_path );
+    if( wpath == NULL )
     {
         free( psz_path );
         return VLC_EGENERIC;
     }
-    wpath[MAX_PATH] = L'\0';
     f = FileRef( wpath );
+    free( wpath );
 #else
     const char* local_name = ToLocale( psz_path );
     if( !local_name )
@@ -679,11 +681,11 @@ static int WriteMeta( vlc_object_t *p_this )
     }
 
 #if defined(WIN32) || defined (UNDER_CE)
-    wchar_t wpath[MAX_PATH + 1];
-    if( !MultiByteToWideChar( CP_UTF8, 0, p_export->psz_file, -1, wpath, MAX_PATH) )
+    wchar_t *wpath = ToWide( p_export->psz_file );
+    if( wpath == NULL )
         return VLC_EGENERIC;
-    wpath[MAX_PATH] = L'\0';
     f = FileRef( wpath );
+    free( wpath );
 #else
     const char* local_name = ToLocale( p_export->psz_file );
     if( !local_name )