DragonFlyBSD Kernel Audit
DF-1515 / fix.diff
← back to finding ↓ download raw
diff --git a/sys/dev/drm/i915/intel_overlay.c b/sys/dev/drm/i915/intel_overlay.c
--- a/sys/dev/drm/i915/intel_overlay.c
+++ b/sys/dev/drm/i915/intel_overlay.c
@@ -919,6 +919,14 @@
 	const struct intel_crtc_state *pipe_config =
 		overlay->crtc->config;
 
+	/*
+	 * DF-1515: zero dst_height/dst_width would bypass the bounds
+	 * comparison below (always-true) and trigger a divide-by-zero
+	 * in check_overlay_scaling().  Reject explicitly.
+	 */
+	if (rec->dst_width == 0 || rec->dst_height == 0)
+		return -EINVAL;
+
 	if (rec->dst_x < pipe_config->pipe_src_w &&
 	    rec->dst_x + rec->dst_width <= pipe_config->pipe_src_w &&
 	    rec->dst_y < pipe_config->pipe_src_h &&