[LAU] repeatable jack related segfaults

Mathis Ahrens Mathis.Ahrens at gmx.de
Thu Oct 14 21:47:08 UTC 2010


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.

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.
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.

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: fix-lsp-segfault.patch
Type: text/x-patch
Size: 1519 bytes
Desc: not available
URL: <http://lists.linuxaudio.org/pipermail/linux-audio-user/attachments/20101014/a8ba0980/attachment.bin>


More information about the Linux-audio-user mailing list