mesa/src/egl
Kenneth Graunke 4e3297f7d4 egl/x11: calloc dri2_surf so it's properly zeroed
Commit 2282ec0a refactored drawable creation across various platforms
into a new dri2_create_drawable helper function.

The GBM code in platform_drm.c code passed in dri2_surf->gbm_surf as the
loaderPrivate, while most other backends passed in dri2_surf directly.

To try and handle this, the patch checked if dri2_surf->gbm_surf was
non-NULL, and if so, presumed that the caller is the DRM platform and
we should use the dri2_surf->gbm_surf pointer.

This worked for most platforms, which calloc their dri2_surf structure,
zeroing the data.  Unfortunately, platform_x11.c used malloc, leaving
most of the dri2_surf as garbage.  In particular, dri2_surf->gbm_surf
was often non-NULL, causing dri2_create_drawable to try and use it,
passing a garbage pointer to the createNewDrawable hook, usually leading
to a SIGBUS or SIGSEGV when trying to dereference that bad pointer.

Since most callers calloc the data, make platform_x11.c follow suit.

Fixes crashes with i915_dri.so when running dEQP-GLES2.

Reviewed-by: Mathias Fröhlich <Mathias.Froehlich@web.de>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
2019-06-06 22:45:27 -07:00
..
drivers egl/x11: calloc dri2_surf so it's properly zeroed 2019-06-06 22:45:27 -07:00
generate mapi: move genCommon.py to src/mapi/new 2019-01-24 18:13:25 +00:00
main egl: add EGL_platform_device support 2019-06-05 13:35:21 -04:00
wayland delete autotools .gitignore files 2019-04-29 21:17:19 +00:00
Android.mk egl: add EGL_platform_device support 2019-06-05 13:35:21 -04:00
egl-entrypoint-check egl: use the LC_ALL hammer instead of LANG 2018-11-01 17:25:08 +00:00
egl-symbols-check egl: Use correct shared libraries suffix on macOS. 2018-10-11 11:30:00 -07:00
Makefile.sources egl: add base EGL_EXT_device_base implementation 2018-11-01 00:05:43 +00:00
meson.build egl: add EGL_platform_device support 2019-06-05 13:35:21 -04:00
SConscript drm-uapi: use local files, not system libdrm 2019-02-14 11:20:00 +00:00