[Mesa-dev] [PATCH 1/6] egl/x11: bail out if we cannot fetch the xcb connection

Emil Velikov emil.l.velikov at gmail.com
Sat Aug 1 08:09:54 PDT 2015


On 29 July 2015 at 18:17, Matt Turner <mattst88 at gmail.com> wrote:
> On Wed, Jul 29, 2015 at 9:19 AM, Emil Velikov <emil.l.velikov at gmail.com> wrote:
>> Strictly speaking the xcb_connection_has_error() might be sufficient,
>> yet the documentation does not mention what will happen if NULL is fed
>> to the function.
>>
>> Keep things explicit, which will allow us to remove the dri2_dpy->conn
>> checking with the next commit.
>
> Its implementation is
>
> int xcb_connection_has_error(xcb_connection_t *c)
> {
>     /* doesn't need locking because it's read and written atomically. */
>     return c->has_error;
> }
>
> so passing NULL is certainly not okay. :)
Nice find Matt. I've updated the commit message as follows:

The documentation of xcb_connection_has_error() does not mention
what will happen, if NULL is fed to the function.

Upon closer look (props to Matt), it seems that we'll crash as the
implementation dereferences conn.

This will also allow us to remove the dri2_dpy->conn checking with the
next commit.

v2: Reword commit message as per Matt's findings.


More information about the mesa-dev mailing list