Package: libasound2
Version: 1.0.28
Severity: normal
Tags: patch

--- Please enter the report below this line. ---

'aplay -L' segfaults with ALSA configuration containing multiple "@hooks" 
entries. This happens, eg. with libasound2-plugins installed and having one 
@hooks in /etc/asound.conf like following:

@hooks [
        {
                func load
                files [ 
                        "/usr/share/alsa/bluetooth.conf"
                ]
                errors false
        }
]

Attached is a fix for the SIG11 alone - it adds a missing error return check 
from snd_config_copy.

There is another bug somewhere that triggers duplicate entry check in 
snd_config_add (called from snd_config_copy). I added following code
in snd_device_name_hint():

snd_output_t *errout;

fprintf(stderr, "********* snd_config_copy: %d\n", err);
snd_output_stdio_attach(&errout, stderr, 0);
snd_config_save(local_config, errout);
snd_output_close(errout);

And got this [fragment] that make snd_config_copy() fail (note two '0' entries 
below '@hooks'):

@hooks {
        0 {
                func pulse_load_if_running
                files { 
                        0 '/usr/share/alsa/pulse-alsa.conf'
                }
                errors false
        }
        0 {
                func load
                files { 
                        0 '/usr/share/alsa/bluetooth.conf'
                }
                errors false
        }
}

--- System information. ---
Architecture: amd64
Kernel:       Linux 4.2.3mq

Debian Release: 8.2
  900 stable          www.deb-multimedia.org 
  900 stable          security.debian.org 
  900 stable          repos.fds-team.de 
  900 stable          ftp.icm.edu.pl 
  800 oldstable       security.debian.org 
  800 oldstable       ftp.icm.edu.pl 
  700 unstable        www.deb-multimedia.org 
  700 unstable        ftp.icm.edu.pl 
  600 experimental    ftp.icm.edu.pl 
  500 stable          deb.opera.com 
  500 oldstable-proposed-updates ftp.icm.edu.pl 
  500 debian          packages.linuxmint.com 

--- Package information. ---
Package's Depends field is empty.

Package's Recommends field is empty.

Package's Suggests field is empty.
commit 57778277e16a2ec735bd42b2f8e7cc2420ebb7f4
Author: Michał Mirosław <mirq-li...@rere.qmqm.pl>
Date:   Thu Oct 22 07:50:01 2015 +0200

    snd_device_name_hint: handle snd_config_copy() failure
    
    Fixes: f49b2dc522a2564315c76d075203b15a39941e8a
    Signed-off-by: Michał Mirosław <mirq-li...@rere.qmqm.pl>

diff --git a/src/control/namehint.c b/src/control/namehint.c
index b3e646e..1c16362 100644
--- a/src/control/namehint.c
+++ b/src/control/namehint.c
@@ -559,6 +559,8 @@ int snd_device_name_hint(int card, const char *iface, void ***hints)
 	if (err < 0)
 		return err;
 	err = snd_config_copy(&local_config_rw, local_config);
+	if (err < 0)
+		goto _copy_error;
 	list.list = NULL;
 	list.count = list.allocated = 0;
 	list.siface = iface;
@@ -634,6 +636,7 @@ int snd_device_name_hint(int card, const char *iface, void ***hints)
 		snd_config_delete(local_config_rw);
 	if (local_config)
 		snd_config_delete(local_config);
+      __copy_error:
 	if (local_config_update)
 		snd_config_update_free(local_config_update);
 	return err;

Reply via email to