提交 6e4ab830 编写于 作者: A Akinobu Mita 提交者: Mauro Carvalho Chehab

media: ov7740: avoid invalid framesize setting

If the requested framesize by VIDIOC_SUBDEV_S_FMT is larger than supported
framesizes, it causes an out of bounds array access and the resulting
framesize is unexpected.

Avoid out of bounds array access and select the default framesize.

Cc: Wenyou Yang <wenyou.yang@microchip.com>
Cc: Eugen Hristev <eugen.hristev@microchip.com>
Signed-off-by: NAkinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: NSakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: NMauro Carvalho Chehab <mchehab+samsung@kernel.org>
上级 cfe7cc38
...@@ -785,7 +785,11 @@ static int ov7740_try_fmt_internal(struct v4l2_subdev *sd, ...@@ -785,7 +785,11 @@ static int ov7740_try_fmt_internal(struct v4l2_subdev *sd,
fsize++; fsize++;
} }
if (i >= ARRAY_SIZE(ov7740_framesizes)) {
fsize = &ov7740_framesizes[0];
fmt->width = fsize->width;
fmt->height = fsize->height;
}
if (ret_frmsize != NULL) if (ret_frmsize != NULL)
*ret_frmsize = fsize; *ret_frmsize = fsize;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册