summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEmil Velikov <[email protected]>2017-08-07 17:23:19 +0100
committerEmil Velikov <[email protected]>2017-08-29 19:14:13 +0100
commitca9817a6e87bbbd6bb8a9d5218068d6dc2417063 (patch)
treeb9324ac9f552d9f01895678534ad2b373c116d2d
parentdf8e65feb7980319b7e6d382990a8f44cefb8bf4 (diff)
egl: don't NULL deref the .get_capabilities function pointer
One could easily introduce version 3 of the DRI2fenceExtension, extending the struct, while not implementing the above function. Thus we'll end up with NULL pointer, and dereferencing it won't fare too well. Fixes: 0201f01dc4e ("egl: add EGL_ANDROID_native_fence_sync") Cc: Rob Clark <[email protected]> Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Tapani Pälli <[email protected]> (cherry picked from commit f0d053cb6dda908d554d84629bd98e05d383a8f6)
-rw-r--r--src/egl/drivers/dri2/egl_dri2.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index a197e0456fd..0b010125120 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -676,7 +676,8 @@ dri2_setup_screen(_EGLDisplay *disp)
disp->Extensions.KHR_wait_sync = EGL_TRUE;
if (dri2_dpy->fence->get_fence_from_cl_event)
disp->Extensions.KHR_cl_event2 = EGL_TRUE;
- if (dri2_dpy->fence->base.version >= 2) {
+ if (dri2_dpy->fence->base.version >= 2 &&
+ dri2_dpy->fence->get_capabilities) {
unsigned capabilities =
dri2_dpy->fence->get_capabilities(dri2_dpy->dri_screen);
disp->Extensions.ANDROID_native_fence_sync =