Package: libmlt6
Version: 6.2.0-1
Severity: normal
Tags: upstream patch

Dear Maintainer,

When using Flowblade or OpenShot to edit videos, trying to
apply a second LADSPA effect from the swh-tools package to
an audio stream caused a coredump in MLT's jackrack module.

After some debugging, this proved to be lack of a null
pointer check in jackrack: the null pointer was unexpected,
since it corresponded to the LADSPA plugin having been
incorrectly loaded.

After fixing MLT jackrack to not dump core and fixing up the
logging, the problem with LADSPA loading was traced to
unnecessarily using RTLD_GLOBAL in the dlopen() call for the
LADSPA plugin in one of two locations where the plugin was
opened. This (for some reason I don't understand) prevented
the swh_init constructor for the LADSPA plugin from being
called at load time, which in turn caused the plugin to
fail to be configured properly.

With RTLD_GLOBAL removed, MLT worked as expected. Flowblade
applied multiple swh-plugins LADSPA effects to an audio
track successfully.

This patch cleans up the debug logging for MLT jackrack,
prevents a coredump in the case that a LADSPA plugin reports
no configuration, and removes the offending RTLD_GLOBAL.

diff -ru /usr/src/mlt-6.2.0/src/modules/jackrack/jack_rack.c 
./src/modules/jackrack/jack_rack.c
--- /usr/src/mlt-6.2.0/src/modules/jackrack/jack_rack.c 2016-04-20 
19:24:55.000000000 -0700
+++ ./src/modules/jackrack/jack_rack.c  2016-10-02 16:01:44.000000000 -0700
@@ -103,7 +103,11 @@
 {
   plugin_t * plugin = jack_rack_instantiate_plugin (jack_rack, 
saved_plugin->settings->desc);
   if (!plugin)
-    return;
+    {
+      mlt_log_warning( NULL, "%s: could not instantiate object file '%s'\n",
+                       __FUNCTION__, 
saved_plugin->settings->desc->object_file);
+      return;
+    }
   jack_rack->saved_plugins = g_slist_append (jack_rack->saved_plugins, 
saved_plugin);
   process_add_plugin (jack_rack->procinfo, plugin);
   jack_rack_add_plugin (jack_rack, plugin);
diff -ru /usr/src/mlt-6.2.0/src/modules/jackrack/plugin.c 
./src/modules/jackrack/plugin.c
--- /usr/src/mlt-6.2.0/src/modules/jackrack/plugin.c    2016-04-20 
19:24:55.000000000 -0700
+++ ./src/modules/jackrack/plugin.c     2016-10-03 07:53:19.000000000 -0700
@@ -287,26 +287,35 @@
   void * dl_handle;
   const char * dlerr;
   LADSPA_Descriptor_Function get_descriptor;
-    
+  
+  /* clear the error report */
+  dlerror ();
+
   /* open the object file */
+#if 0
   dl_handle = dlopen (desc->object_file, RTLD_NOW|RTLD_GLOBAL);
-  if (!dl_handle)
+#else
+  dl_handle = dlopen (desc->object_file, RTLD_NOW);
+#endif
+  dlerr = dlerror ();
+  if (!dl_handle || dlerr)
     {
+      if (!dlerr)
+          dlerr = "unknown error";
       mlt_log_warning( NULL, "%s: error opening shared object file '%s': %s\n",
-               __FUNCTION__, desc->object_file, dlerror());
+               __FUNCTION__, desc->object_file, dlerr);
       return 1;
     }
 
   
   /* get the get_descriptor function */
-  dlerror (); /* clear the error report */
-  
   get_descriptor = (LADSPA_Descriptor_Function)
     dlsym (dl_handle, "ladspa_descriptor");
-  
   dlerr = dlerror();
   if (dlerr)
     {
+      if (!dlerr)
+          dlerr = "unknown error";
       mlt_log_warning( NULL, "%s: error finding descriptor symbol in object 
file '%s': %s\n",
                __FUNCTION__, desc->object_file, dlerr);
       dlclose (dl_handle);
@@ -321,6 +330,13 @@
 #endif
 
   *descriptor_ptr = get_descriptor (desc->index);
+  if (!*descriptor_ptr)
+    {
+      mlt_log_warning( NULL, "%s: error finding index %lu in object file 
'%s'\n",
+              __FUNCTION__, desc->index, desc->object_file);
+      dlclose (dl_handle);
+      return 1;
+    }
   *dl_handle_ptr = dl_handle;
   
   return 0;
diff -ru /usr/src/mlt-6.2.0/src/modules/jackrack/plugin_mgr.c 
./src/modules/jackrack/plugin_mgr.c
--- /usr/src/mlt-6.2.0/src/modules/jackrack/plugin_mgr.c        2016-04-20 
19:24:55.000000000 -0700
+++ ./src/modules/jackrack/plugin_mgr.c 2016-10-03 07:53:19.000000000 -0700
@@ -147,7 +147,7 @@
       plugin_mgr->plugin_count++;
       
       /* print in the splash screen */
-      /* mlt_log_verbose( NULL, "Loaded plugin '%s'\n", desc->name); */
+      mlt_log_verbose( NULL, "Loaded plugin '%s'\n", desc->name);
     }
   
   err = dlclose (dl_handle);



-- System Information:
Debian Release: stretch/sid
  APT prefers unstable
  APT policy: (900, 'unstable'), (400, 'oldoldstable'), (400, 'testing'), (400, 
'stable'), (400, 'oldstable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.6.0-1-amd64 (SMP w/8 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages libmlt6 depends on:
ii  libavcodec57                      7:3.1.3-1+b3
ii  libavdevice57                     7:3.1.3-1+b3
ii  libavfilter6                      7:3.1.3-1+b3
ii  libavformat57                     7:3.1.3-1+b3
ii  libavutil55                       7:3.1.3-1+b3
ii  libc6                             2.24-3
ii  libepoxy0                         1.3.1-1
ii  libexif12                         0.6.21-2
ii  libfftw3-double3                  3.3.4-2+b2
ii  libgcc1                           1:6.2.0-5
ii  libgdk-pixbuf2.0-0                2.36.0-1
ii  libgl1-mesa-glx [libgl1]          12.0.3-1
ii  libglib2.0-0                      2.50.0-1
ii  libgtk2.0-0                       2.24.31-1
ii  libjack-jackd2-0 [libjack-0.116]  1.9.10+20150825git1ed50c92~dfsg-2
ii  libmlt++3                         6.2.0-1
ii  libmovit4                         1.3.2-1
ii  libpango-1.0-0                    1.40.3-2
ii  libpangoft2-1.0-0                 1.40.3-2
ii  libqt4-opengl                     4:4.8.7+dfsg-9
ii  libqt4-svg                        4:4.8.7+dfsg-9
ii  libqt4-xml                        4:4.8.7+dfsg-9
ii  libqtcore4                        4:4.8.7+dfsg-9
ii  libqtgui4                         4:4.8.7+dfsg-9
ii  librtaudio5a                      4.1.2~ds0-4
ii  libsamplerate0                    0.1.8-8
ii  libsdl1.2debian                   1.2.15+dfsg1-4
ii  libsox2                           14.4.1-5+b1
ii  libstdc++6                        6.2.0-5
ii  libswscale4                       7:3.1.3-1+b3
ii  libx11-6                          2:1.6.3-1
ii  libxml2                           2.9.4+dfsg1-2

Versions of packages libmlt6 recommends:
ii  libmlt-data  6.2.0-1

libmlt6 suggests no packages.

-- no debconf information

Reply via email to