Skip to contentSkip to conversation

vivi: fix ENUM_FRAMEINTERVALS implementation.

PATCH New Hans Verkuil 1 participant 1 message Feb 17, 2014 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 vivi: fix ENUM_FRAMEINTERVALS implementation.

This function never checked if width and height are correct. Add such a check so the v4l2-compliance tool returns OK again for vivi.

---
 drivers/media/platform/vivi.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/media/platform/vivi.c +5 -1
index 97428e2..ce9a4f2 100644
@@ -1121,7 +1121,11 @@ static int vidioc_enum_frameintervals(struct file *file, void *priv,
 	if (!fmt)
 		return -EINVAL;
 
-	/* regarding width & height - we support any */
+	/* check for valid width/height */
+	if (fival->width < 48 || fival->width > MAX_WIDTH || (fival->width & 3))
+		return -EINVAL;
+	if (fival->height < 32 || fival->height > MAX_HEIGHT)
+		return -EINVAL;
 
 	fival->type = V4L2_FRMIVAL_TYPE_CONTINUOUS;
 
Signature · 1 line
1.8.5.1