xf86: check return value of XF86_CRTC_CONFIG_PTR in xf86CompatOutput()

If privates[xf86CrtcConfigPrivateIndex].ptr is NULL, this will cause
a segfault.

Possible fix for !1241

Signed-off-by: Benjamin Valentin <benjamin.valentin@ml-pa.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/835>
This commit is contained in:
Benjamin Valentin 2021-12-27 14:53:22 +01:00 committed by Marge Bot
parent 444822f7c1
commit 907c501926

View file

@ -842,7 +842,7 @@ xf86CompatOutput(ScrnInfoPtr pScrn)
if (xf86CrtcConfigPrivateIndex == -1)
return NULL;
config = XF86_CRTC_CONFIG_PTR(pScrn);
if (config->compat_output < 0)
if ((config == NULL) || (config->compat_output < 0))
return NULL;
return config->output[config->compat_output];
}