alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Alejandro Gonzalez <x0092071@ti.com>
To: alsa-devel@alsa-project.org
Cc: Liam Girdwood <lrg@slimlogic.co.uk>
Subject: UCM list 'modifiers' Seg-Fault when list is empty
Date: Wed, 16 Mar 2011 13:40:22 -0600	[thread overview]
Message-ID: <1300304422.1650.191.camel@dexx0092071-ubuntu> (raw)

[-- Attachment #1: Type: text/plain, Size: 964 bytes --]

Hi, 

I've been testing the Alsa UCM and find that when listing 'modifiers'
there is a segmentation fault if the list is empty.

$ alsaucm -c Panda set _verb HiFi list _modifiers
  Im setting defaults
    list is empty
 Segmentation fault (core dumped)

Using 'gdb' I see that the issue is trying to free a not NULL pointer.
Program received signal SIGSEGV, Segmentation fault.
0x402a096c in free () from /lib/libc.so.6
(gdb) bt
#0  0x402a096c in free () from /lib/libc.so.6
#1  0x40221224 in snd_use_case_free_list () from /usr/lib/libasound.so.2
#2  0x00008d8a in do_one (context=0x13008) at usecase.c:256
#3  do_commands (context=0x13008) at usecase.c:329
#4  0x000091aa in main (argc=<value optimized out>, argv=0xbe9986c4) at
usecase.c:440
(gdb) quit

But this can be easily resolved with the correct initialization of the
'**list' pointer on the 'do_one' function in 'alsaucm/usecase.c'. 

You can find a patch attached to the mail.

Regards, 

Alejandro




[-- Attachment #2: Alsa-UCM-list-modifiers-Segmentation-Fault.patch --]
[-- Type: text/x-patch, Size: 312 bytes --]


--- /home/ubuntu/usecase.c	2011-03-16 13:03:07.000000000 -0600
+++ ./alsaucm/usecase.c	2011-03-16 12:45:33.000000000 -0600
@@ -170,7 +170,7 @@
 
 static int do_one(struct context *context, struct cmd *cmd, char **argv)
 {
-	const char **list, *str;
+	const char **list=NULL, *str;
 	long lval;
 	int err, i;




[-- Attachment #3: Type: text/plain, Size: 160 bytes --]

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

                 reply	other threads:[~2011-03-16 19:42 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1300304422.1650.191.camel@dexx0092071-ubuntu \
    --to=x0092071@ti.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=lrg@slimlogic.co.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).