[LAU] repeatable jack related segfaults

torbenh torbenh at gmx.de
Thu Oct 14 23:12:01 UTC 2010


On Thu, Oct 14, 2010 at 11:47:08PM +0200, Mathis Ahrens wrote:
> Julien Claassen wrote [2010-09-06] :
> >Hello everyone!
> >  I'm experiencing trouble with jack and multiple servers. The
> >moment I start a second jackserver (for net I/O) and try:
> >jack_lsp -s new_name
> >  jack_lsp segfaults.
> 
> [follow-up: jack-devel]
> 
> Hi!
> 
> I have been bitten too, and found the bug:
> 
> jack_get_ports() may return NULL if no ports matched,
> and jack_lsp uses this function on line 138 like this:
> 
>    ports = jack_get_ports( client, NULL, NULL, 0)
> 
>    for (i = 0; ports[i]; ++i) {
>       ...
>    }
> 
> which obviously does not check for NULL.

this should be fixed.
but i would prefer this:
http://hochstrom.endofinternet.org/cgit/jack.git/commit/?id=0696759597e3c6d157e88a5738fe125185dd2dce

jack_lsp isnt calling jack_free() ... this is also pretty bad.

http://hochstrom.endofinternet.org/cgit/jack.git/commit/?id=6c7f82f06322516cbb4e13682c4e8e00a271dff7

> 
> Attached is a patch that fixes this.
> Note that this also touches libjack/clients.c because
> I think it is wrong to return NULL when no ports match.

this should be discussed.

> There should be a distinction between a failed malloc and
> no matching ports.
> The array is already allocated, and the user has to free it
> anyway, so there is nothing wrong with returning it empty.

probably right.
i am a bit concerned that it might cause some subtle bugs, though.

> 
> Patch is against SVN but should apply with offsets against
> 0.118, too.
> 
> Bug test case:
>    console1> jackd -dnet
>    console2> jack_lsp
>        Segmentation Fault
> 
> Cheers,
> Mathis
> 


> _______________________________________________
> Linux-audio-user mailing list
> Linux-audio-user at lists.linuxaudio.org
> http://lists.linuxaudio.org/listinfo/linux-audio-user


-- 
torben Hohn


More information about the Linux-audio-user mailing list