[PATCH xserver] edid: fix off-by-one error in CEA mode numbering

Hector Martin marcan at marcan.st
Tue Nov 14 18:12:31 UTC 2017


The CEA extension short video descriptors contain the VIC, which starts
at 1, not 0.

Signed-off-by: Hector Martin <marcan at marcan.st>
---
 hw/xfree86/modes/xf86EdidModes.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/xfree86/modes/xf86EdidModes.c b/hw/xfree86/modes/xf86EdidModes.c
index 908c5a4cf..ff04eca03 100644
--- a/hw/xfree86/modes/xf86EdidModes.c
+++ b/hw/xfree86/modes/xf86EdidModes.c
@@ -970,8 +970,8 @@ handle_cea_svd(struct cea_video_block *video, void *data)
     int vid;
 
     vid = video->video_code & 0x7f;
-    if (vid < CEA_VIDEO_MODES_NUM) {
-        Mode = xf86DuplicateMode(CEAVideoModes + vid);
+    if (vid >= 1 && vid <= CEA_VIDEO_MODES_NUM) {
+        Mode = xf86DuplicateMode(CEAVideoModes + (vid - 1));
         *Modes = xf86ModesAdd(*Modes, Mode);
     }
 }
-- 
2.14.3



More information about the xorg-devel mailing list