This is an automated email from the git hooks/post-receive script.

git pushed a commit to reference refs/pull/50/head
in repository enlightenment.

View the commit online.

commit 4bd15e3fec44ee703efa7315e0d87bc93b2a82f9
Author: Andre Schulz <an...@exhale.de>
AuthorDate: Wed Sep 13 21:13:10 2023 +0200

    mixer: alsa: Handle error from _alsa_card_create()
    
    _alsa_card_create() can return NULL which can lead to a segmentation
    fault inside ALSA when NULL is passed to snd_mixer_first_elem() in
    _alsa_cards_refresh(). See the following crash dump excerpt:
    
    Thread 1 (Thread 0x7fe64b227780 (LWP 3320) "enlightenment"):
    #0  0x00007fe64c2fbd92 in __libc_pause () at ../sysdeps/unix/sysv/linux/pause.c:29
            sc_ret = -514
            sc_cancel_oldtype = 0
            sc_ret = <optimized out>
    #1  <signal handler called>
    No locals.
    #2  list_empty (p=0x20) at /var/tmp/portage/media-libs/alsa-lib-1.2.9/work/alsa-lib-1.2.9/include/list.h:114
    No locals.
    #3  snd_mixer_first_elem (mixer=mixer@entry=0x0) at /var/tmp/portage/media-libs/alsa-lib-1.2.9/work/alsa-lib-1.2.9/src/mixer/mixer.c:803
    No locals.
    #4  0x00007fe63b2a376f in _alsa_cards_refresh () at ../enlightenment-0.25.4/src/modules/mixer/lib/backends/alsa/alsa.c:304
            buf = "hw:0\000le.emix.cfg\000C\236:\245U\000\000\035\221.;\346\177\000\000`>[;\245U\000\000\260g\302:\245U\000\000pL[;\245U\000\000ʁ-:\245U\000\000/home/andre/.e/e/config/standard/module.gadman.cfg", '\000' <repeats 710 times>...
            mixer = 0x0
            device_name = <optimized out>
            elem = <optimized out>
            source = 0x0
            sink = 0x0
            err = <optimized out>
            card_num = 0
            tmp_source = 0x0
            tmp_sink = 0x0
---
 src/modules/mixer/lib/backends/alsa/alsa.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/modules/mixer/lib/backends/alsa/alsa.c b/src/modules/mixer/lib/backends/alsa/alsa.c
index 867c0ea61..1dfb44e15 100644
--- a/src/modules/mixer/lib/backends/alsa/alsa.c
+++ b/src/modules/mixer/lib/backends/alsa/alsa.c
@@ -299,6 +299,9 @@ _alsa_cards_refresh(void)
         //save the addr to see if there are missing devices in the cache list
 
         mixer = _alsa_card_create(buf);
+        if (!mixer)
+          continue;
+
         ctx->cards = eina_list_append(ctx->cards, mixer);
         //get elements of the device
         elem = snd_mixer_first_elem(mixer);

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.

Reply via email to