From 28159eff6badf6181b255f26d1f444abe81c05b7 Mon Sep 17 00:00:00 2001 From: Jason Gerecke Date: Thu, 30 Apr 2015 18:06:14 -0700 Subject: xfree86: Return NULL from xf86CompatOutput if no compat_output is defined If no compat_output is defined, we inadvertently (attempt to) return whatever data is at index -1. Instead, return NULL since that's what callers are expecting. Reviewed-by: Adam Jackson Signed-off-by: Jason Gerecke --- hw/xfree86/modes/xf86Crtc.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hw/xfree86/modes/xf86Crtc.h b/hw/xfree86/modes/xf86Crtc.h index 3c5bbcfd5..8b0160845 100644 --- a/hw/xfree86/modes/xf86Crtc.h +++ b/hw/xfree86/modes/xf86Crtc.h @@ -745,6 +745,8 @@ xf86CompatOutput(ScrnInfoPtr pScrn) { xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn); + if (config->compat_output < 0) + return NULL; return config->output[config->compat_output]; } -- cgit v1.2.3