[Mesa-dev] [PATCH] egl_dri2: Fix segmentation fault

Ian Romanick idr at freedesktop.org
Fri Aug 17 20:20:30 PDT 2012


On 08/17/2012 10:08 AM, Paulo Alcantara wrote:
> The segmentation fault occurs when DRI2 is not loaded up and
> dri2_setup_screen() function deferences dri2_dpy->dri2 (since it's NULL
> at this point).
>
> This patch fixes the segmentation fault by checking if dri2 pointer is
> not NULL before deferencing it.

Which only happens with swrast, right?

> Signed-off-by: Paulo Alcantara <pcacjr at profusion.mobi>

Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>

> ---
>   src/egl/drivers/dri2/egl_dri2.c |    2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
> index 423d18d..7326b85 100644
> --- a/src/egl/drivers/dri2/egl_dri2.c
> +++ b/src/egl/drivers/dri2/egl_dri2.c
> @@ -481,7 +481,7 @@ dri2_setup_screen(_EGLDisplay *disp)
>      assert(dri2_dpy->dri2 || dri2_dpy->swrast);
>      disp->Extensions.KHR_surfaceless_context = EGL_TRUE;
>
> -   if (dri2_dpy->dri2->base.version >= 3) {
> +   if (dri2_dpy->dri2 && dri2_dpy->dri2->base.version >= 3) {
>         disp->Extensions.KHR_create_context = EGL_TRUE;
>
>         if (dri2_dpy->robustness)
>


More information about the mesa-dev mailing list