From 0f13e1aad00149d7a4105bead8d7164492890965 Mon Sep 17 00:00:00 2001 From: Benjamin Valentin Date: Mon, 27 Dec 2021 14:53:22 +0100 Subject: [PATCH] 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 --- hw/xfree86/modes/xf86Crtc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/xfree86/modes/xf86Crtc.h b/hw/xfree86/modes/xf86Crtc.h index e36adbe00..224fcb951 100644 --- a/hw/xfree86/modes/xf86Crtc.h +++ b/hw/xfree86/modes/xf86Crtc.h @@ -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]; }