From 139bd0a465a45e57ce1f8d16f744aa0c545b0d0e Mon Sep 17 00:00:00 2001 From: Gerd Knorr Date: Mon, 30 Aug 2004 20:42:07 -0700 Subject: [PATCH] [PATCH] v4l/bttv: add sanity check (bug #3309) Missing sanity check, overlay is supported for packed pixel formats only. Patch below. It's not API related btw, the bug can be triggered using the v4l2 API as well. Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/media/video/bttv-driver.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/media/video/bttv-driver.c b/drivers/media/video/bttv-driver.c index e7ffe18411fb0..2ac1b0efd2577 100644 --- a/drivers/media/video/bttv-driver.c +++ b/drivers/media/video/bttv-driver.c @@ -1861,6 +1861,8 @@ static int setup_window(struct bttv_fh *fh, struct bttv *btv, if (NULL == fh->ovfmt) return -EINVAL; + if (!(fh->ovfmt->flags & FORMAT_FLAGS_PACKED)) + return -EINVAL; retval = verify_window(&bttv_tvnorms[btv->tvnorm],win,fixup); if (0 != retval) return retval; -- 2.53.0