[vlc-commits] lua: do not probe directories as playlist

Rémi Denis-Courmont git at videolan.org
Wed May 17 18:27:48 CEST 2017


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Wed May 17 19:22:03 2017 +0300| [4eae96defafbc5ef05fda51968e6563bb9e6c938] | committer: Rémi Denis-Courmont

lua: do not probe directories as playlist

Directories can never be handled by Lua playlist parsers; there are no
Lua functions to even handle that case at all. It is not clear that
there even be a point in doing so. So save time by skipping directories
altogether.

This also works around the problem that URL-based Lua scripts would
match its own self recursively.

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

 modules/lua/demux.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/modules/lua/demux.c b/modules/lua/demux.c
index c66a739b72..70c5fe56be 100644
--- a/modules/lua/demux.c
+++ b/modules/lua/demux.c
@@ -276,8 +276,11 @@ static int ReadDir(stream_t *s, input_item_node_t *node)
 int Import_LuaPlaylist(vlc_object_t *obj)
 {
     stream_t *s = (stream_t *)obj;
-    struct vlclua_playlist *sys = malloc(sizeof (*sys));
 
+    if( !vlc_stream_Control( s->p_source, STREAM_IS_DIRECTORY ) )
+        return VLC_EGENERIC;
+
+    struct vlclua_playlist *sys = malloc(sizeof (*sys));
     if (unlikely(sys == NULL))
         return VLC_ENOMEM;
 



More information about the vlc-commits mailing list