egl/wayland: add a NULL guard for the authenticate callback
authorSimon Ser <contact@emersion.fr>
Tue, 8 Dec 2020 18:17:37 +0000 (19:17 +0100)
committerMarge Bot <eric+marge@anholt.net>
Wed, 16 Dec 2020 13:48:48 +0000 (13:48 +0000)
commitc37d8ae82b9d6ad30ebffbc8bf043afa0f5b6cc5
tree8bb276c7162cb38caa92178f94debdb1cc0596fc
parenta709d99bfd7982bcb15d2c98bea5bc8de91ea0a7
egl/wayland: add a NULL guard for the authenticate callback

On some platforms, the authenticate callback may be NULL, e.g. on
surfaceless. If a client tries to send a wl_drm.authenticate request
the handler tries to dereference the NULL pointer.

This can be reproduced with libva which unconditionally tries to use
wl_drm.authenticate even with render nodes [1]. Run a compositor with
a surfaceless context, then try to start e.g. mpv to trigger the
segfault.

[1]: https://github.com/intel/libva/pull/476

Signed-off-by: Simon Ser <contact@emersion.fr>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7992>
src/egl/wayland/wayland-drm/wayland-drm.c