Bug#786737: jackd1: crashes with -n option specified

Frank Heckenbach f.heckenbach at fh-soft.de
Mon May 25 02:53:18 UTC 2015


Package: jackd1
Version: 1:0.124.1+20140122git5013bed0-3
Severity: normal
Tags: upstream patch

When the "-n" option is given, jackd crashes when accessing
properties (which it seems to do implicitly for any client, e.g.
jack_lsp).

To reproduce:

  jackd -nfoo -dalsa
or
  JACK_DEFAULT_SERVER=bar jackd -nfoo -dalsa

While jackd is running, repeat this:

  JACK_DEFAULT_SERVER=foo jack_lsp

After a few tries, jackd crashes:

  /dev/shm/jack-0/default/__db.001: No such file or directory
  cannot open DB environment: No such file or directory
  Segmentation fault

I found several problems in the code:

- jack_property_init():

  Returns early if db_env != NULL. However, on failure later returns
  with db_env != NULL, but db == NULL. Callers assume db != NULL
  after it returns.

  Patch below. This fixes at least the segfault, but the error
  message remains (and whatever consequences it may have, I don't
  know).

- 7 places in metadata.c:

        if (jack_property_init (NULL)) {

  If NULL is passed for server_name, of course it won't use the
  actual server name.

  How is this supposed to work at all? Was it ever tested?

  A fix should consist of passing the actual server name from the
  callers.

--- libjack/metadata.c
+++ libjack/metadata.c
@@ -45,11 +45,11 @@
 
         /* idempotent */
 
-        if (db_env) {
+        if (db) {
                 return 0;
         }
 
-        if ((ret = db_env_create(&db_env, 0)) != 0) { 
+        if (!db_env && (ret = db_env_create(&db_env, 0)) != 0) {
                 jack_error ("cannot initialize DB environment: %s\n", db_strerror(ret));
                 return -1;
         } 



More information about the pkg-multimedia-maintainers mailing list