[vlc-commits] meta: taglib: reject non expected schemes

Francois Cartegnie git at videolan.org
Thu Sep 3 21:32:30 CEST 2020


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Wed Sep  2 16:53:13 2020 +0200| [8191ac5727a3525a6bee99e1674167a7894f9ccb] | committer: Francois Cartegnie

meta: taglib: reject non expected schemes

refs #25035

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

 modules/meta_engine/taglib.cpp | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/modules/meta_engine/taglib.cpp b/modules/meta_engine/taglib.cpp
index 751e9ded97..480968edfd 100644
--- a/modules/meta_engine/taglib.cpp
+++ b/modules/meta_engine/taglib.cpp
@@ -852,6 +852,23 @@ static void ReadMetaFromMP4( MP4::Tag* tag, demux_meta_t *p_demux_meta, vlc_meta
     }
 }
 
+static bool isSchemeCompatible( const char *psz_uri )
+{
+    const char *p = strstr( psz_uri, "://" );
+    if( p == NULL )
+        return false;
+
+    size_t i_len = p - psz_uri;
+    const char * compatibleschemes[] =
+    {
+        "file", "smb",
+    };
+    for( size_t i=0; i<ARRAY_SIZE(compatibleschemes); i++ )
+        if( !strncasecmp( psz_uri, compatibleschemes[i], i_len ) )
+            return true;
+    return false;
+}
+
 /**
  * Get the tags from the file using TagLib
  * @param p_this: the demux object
@@ -870,6 +887,12 @@ static int ReadMeta( vlc_object_t* p_this)
     if( unlikely(psz_uri == NULL) )
         return VLC_ENOMEM;
 
+    if( !isSchemeCompatible( psz_uri ) )
+    {
+        free( psz_uri );
+        return VLC_EGENERIC;
+    }
+
     if( !b_extensions_registered )
     {
         FileRef::addFileTypeResolver( &aacresolver );



More information about the vlc-commits mailing list