[libcamera-devel] [PATCH v2 3/7] v4l2: v4l2_camera_proxy: Fix bounds check for VIDIOC_ENUM_FMT
Niklas Söderlund
niklas.soderlund at ragnatech.se
Fri Jun 5 20:17:56 CEST 2020
Hi Paul,
Thanks for your work.
On 2020-06-05 18:01:02 +0900, Paul Elder wrote:
> VIDIOC_ENUM_FMT is meant to return -EINVAL if the requested index is out
> of bounds. This bounds is obtained from the libcamera Camera's list of
> formats. The bounds check for this list was incorrect; fix it.
>
> Signed-off-by: Paul Elder <paul.elder at ideasonboard.com>
> Reviewed-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund at ragnatech.se>
>
> ---
> No change in v2
> ---
> src/v4l2/v4l2_camera_proxy.cpp | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/v4l2/v4l2_camera_proxy.cpp b/src/v4l2/v4l2_camera_proxy.cpp
> index 3df4d42b..ec6d265d 100644
> --- a/src/v4l2/v4l2_camera_proxy.cpp
> +++ b/src/v4l2/v4l2_camera_proxy.cpp
> @@ -224,7 +224,7 @@ int V4L2CameraProxy::vidioc_enum_fmt(struct v4l2_fmtdesc *arg)
> LOG(V4L2Compat, Debug) << "Servicing vidioc_enum_fmt";
>
> if (!validateBufferType(arg->type) ||
> - arg->index > streamConfig_.formats().pixelformats().size())
> + arg->index >= streamConfig_.formats().pixelformats().size())
> return -EINVAL;
>
> /* \todo Add map from format to description. */
> --
> 2.20.1
>
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel at lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel
--
Regards,
Niklas Söderlund
More information about the libcamera-devel
mailing list