Re: [LAU] repeatable jack related segfaults

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: linux-audio-user <linux-audio-user@...>
Cc: <jack-devel@...>
Date: Thursday, October 14, 2010 - 9:47 pm

Julien Claassen wrote [2010-09-06] :

[follow-up: jack-devel]


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


Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[LAU] repeatable jack related segfaults, Julien Claassen, (Mon Sep 6, 4:09 pm)
Re: [LAU] repeatable jack related segfaults, Mathis Ahrens, (Thu Oct 14, 9:47 pm)
Re: [LAU] repeatable jack related segfaults, torbenh, (Thu Oct 14, 11:12 pm)