Skip to contentSkip to conversation

drm: edid: Add bounds checking to CEA 18 byte descriptor parsing

PATCH In review [email protected] 2 participants 2 messages Mar 1, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm: edid: Add bounds checking to CEA 18 byte descriptor parsing

From: Ville Syrjälä <[email protected]>

Make sure we don't access beyond the extension block when parsing CEA detailed timing descriptors.

---
 drivers/gpu/drm/drm_edid.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
drivers/gpu/drm/drm_edid.c +3 -0
index 7ee7be1..0194d4a 100644
@@ -516,6 +516,9 @@ cea_for_each_detailed_block(u8 *ext, detailed_cb *cb, void *closure)
 	u8 d = ext[0x02];
 	u8 *det_base = ext + d;
 
+	if (d > 127)
+		return;
+
 	n = (127 - d) / 18;
 	for (i = 0; i < n; i++)
 		cb((struct detailed_timing *)(det_base + 18 * i), closure);
Signature · 6 lines
1.7.3.4

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · On Thu, Mar 1, 2012 at 7:01 AM, <[email protected]> wrote:

From: Ville Syrjälä <[email protected]>

Make sure we don't access beyond the extension block when parsing CEA detailed timing descriptors.

Quoted 25 lines

---
 drivers/gpu/drm/drm_edid.c |    3 +++

 1 files changed, 3 insertions(+), 0 deletions(-)
drivers/gpu/drm/drm_edid.c +3 -1
index 7ee7be1..0194d4a 100644
@@ -516,6 +516,9 @@ cea_for_each_detailed_block(u8 *ext, detailed_cb *cb, void *closure)
        u8 d = ext[0x02];
        u8 *det_base = ext + d;
 
+       if (d > 127)
+               return;
+
        n = (127 - d) / 18;
        for (i = 0; i < n; i++)
                cb((struct detailed_timing *)(det_base + 18 * i), closure);
--

1.7.3.4

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel