egl/x11: don't forget to exit the attrib list loop
Without this check, if we receive any attribs from the client, we either
find an X11/XCB screen fd in there, or we keep going until we end up in
random bits of memory and crash.
Fixes: 4aebd86f9a
("egl/x11: pick the user requested screen")
Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10717>
This commit is contained in:
parent
90d2631027
commit
2af08bf7b6
|
@ -1211,7 +1211,10 @@ dri2_find_screen_for_display(const _EGLDisplay *disp, int fallback_screen)
|
||||||
{
|
{
|
||||||
const EGLAttrib *attr;
|
const EGLAttrib *attr;
|
||||||
|
|
||||||
for (attr = disp->Options.Attribs; attr; attr += 2) {
|
if (!disp->Options.Attribs)
|
||||||
|
return fallback_screen;
|
||||||
|
|
||||||
|
for (attr = disp->Options.Attribs; attr[0] != EGL_NONE; attr += 2) {
|
||||||
if (attr[0] == EGL_PLATFORM_X11_SCREEN_EXT ||
|
if (attr[0] == EGL_PLATFORM_X11_SCREEN_EXT ||
|
||||||
attr[0] == EGL_PLATFORM_XCB_SCREEN_EXT)
|
attr[0] == EGL_PLATFORM_XCB_SCREEN_EXT)
|
||||||
return attr[1];
|
return attr[1];
|
||||||
|
|
Loading…
Reference in New Issue