[Xcb] Segmentation fault while looping through protocol atoms list
Michael Stapelberg
michael+xcb at stapelberg.de
Wed Nov 28 04:20:13 PST 2012
Hi Micah,
Micah Nordland <mpnordland at gmail.com> writes:
> The problem is, I get a sigsegv on the third create notify. The reason is
> that with the previous two createnotifys is that the list of atoms was only
> 3 or 4 items long, but with the third, it's this huge number,
> 4294959856.
This number suggests the memory is uninitialized. It’s completely out of
scope for a legitimate reply.
> Here is my code for getting the list:
>
> xcb_icccm_get_wm_protocols_reply_t Window::getWMProtocols()
> {
> xcb_icccm_get_wm_protocols_reply_t reply;
> xcb_get_property_cookie_t cookie =
> xcb_icccm_get_wm_protocols_unchecked(globalconf.conn,
>
> _id,
>
> globalconf.atomMap["WM_PROTOCOLS"]);
> xcb_icccm_get_wm_protocols_reply(globalconf.conn, cookie, &reply, NULL);
> return reply;
> }
You are not properly checking errors here. See also
https://github.com/mstap/libxcb/blob/master/src/static-man/xcb-requests.3
for more details on checked/unchecked requests and error handling.
--
Best regards,
Michael
More information about the Xcb
mailing list