[LAD] c/jack question

Gabriel M. Beddingfield gabrbedd at gmail.com
Sun Apr 8 17:43:15 UTC 2012


On 04/08/2012 12:01 PM, Egor Sanin wrote:
>> In B, pos (IIRC) would be initialized to NULL as it is in the file scope.
>> So when you call jack_transport_query, you have provided a pointer to
>> NULL, where any memory access will be invalid.
>
> But then why does jack_transport_query not give any error when it is
> passed a NULL pointer in the form of pos?

Because it's valid to do this according to the docs:

 
http://jackaudio.org/files/docs/html/group__TransportControl.html#ga5f08eb71a5ee5431a3d756af5729d5aa

If pos is NULL it just ignores it.  It's not an error at all.

OTOH, if pos is uninitialized, then jack will try to write the data to 
whatever random address in in pos... and that will usually segfault.

> If I remove the line
> frame = pos->frame;
> from B, the code runs, state is set properly and jackd doesn't report problems.

This suggests that pos is indeed NULL, and you tried to dereference a 
null pointer... which will always segfault.

-gabriel



More information about the Linux-audio-dev mailing list