[pulseaudio-discuss] Pulse segfault when xcb related funcitnos are called.

Colin Guthrie gmane at colin.guthr.ie
Fri Sep 17 06:12:21 PDT 2010

'Twas brillig, and Colin Guthrie at 17/09/10 09:42 did gyre and gimble:
> 'Twas brillig, and Colin Guthrie at 17/09/10 09:22 did gyre and gimble:
>> I guess it's likely some resurfacing of something similar to this.
>> So I think that's all a red herring.
> Go go gadget contradict-o-tron.
> Ignore the first line, I think those bugs are likely unrelated.
> I wonder if perhaps it's a problem that there are no screens :s
> Perhaps calling:
> xcb_setup_roots_length() first and checking the value to see if it's > 0
> would avoid the problems?
> Actually in looking at this I think I can see how to fix the missing
> functionality in the master version which appears to check additional
> screens of the display. I'm obviously only chekcing the first, with this
> patch (as did 0.9.21) but git master checks additional screens.
> I guess checking for the length is a valid thing to do.
> Are you able to reproduce the bug yourself?
> Col

Looking at the implementation of xcb_setup_vendor_end, it ultimately
dereferences *R:

xcb_setup_vendor_end (const xcb_setup_t *R  /**< */)
    xcb_generic_iterator_t i;
    i.data = ((char *) (R + 1)) + (R->vendor_len);
    i.rem = 0;
    i.index = (char *) i.data - (char *) R;
    return i;

Now we make sure the xcb connection itself is fine when we use it but I
do not check the return value of xcb_get_setup() (as it was not checked
in the tutorial).

Accroding to it's implementation however:

const xcb_setup_t *xcb_get_setup(xcb_connection_t *c)
        return 0;
    /* doesn't need locking because it's never written to. */
    return c->setup;

It can easily return 0.

I guess I need to deal with that case. Should be a simple patch. I'll
get something out later today.



Colin Guthrie

Day Job:
  Tribalogic Limited [http://www.tribalogic.net/]
Open Source:
  Mandriva Linux Contributor [http://www.mandriva.com/]
  PulseAudio Hacker [http://www.pulseaudio.org/]
  Trac Hacker [http://trac.edgewall.org/]

More information about the pulseaudio-discuss mailing list