[PATCH 1/2] libcamera: formats: Fix planes bounds check

Kieran Bingham kieran.bingham at ideasonboard.com
Mon Feb 26 10:56:49 CET 2024


Quoting Kieran Bingham (2024-02-26 09:48:56)
> The plane validation in the stride helper incorrectly accepts the number
> of planes as a plane index. Fix the off by one issue.
> 
> Reported-by: Johan Mattsson <39247600+mjunix at users.noreply.github.com>

As that's a @users.noreply this bounces and I don't think I can really
keep this as is, even though that's what Github seems to provide.

I could do:

Reported-by: Johan Mattsson <mjunix at github.com>

Perhaps, or simply lose the reporter.
Opinions anyone ?

--
Kieran


> Fixes: e83727a194b5 ("libcamera: PixelFormatInfo: Add functions stride and frameSize")
> Signed-off-by: Kieran Bingham <kieran.bingham at ideasonboard.com>
> ---
>  src/libcamera/formats.cpp | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/libcamera/formats.cpp b/src/libcamera/formats.cpp
> index 447e623803c7..c11fbd730c8e 100644
> --- a/src/libcamera/formats.cpp
> +++ b/src/libcamera/formats.cpp
> @@ -987,7 +987,7 @@ unsigned int PixelFormatInfo::stride(unsigned int width, unsigned int plane,
>                 return 0;
>         }
>  
> -       if (plane > planes.size() || !planes[plane].bytesPerGroup) {
> +       if (plane >= planes.size() || !planes[plane].bytesPerGroup) {
>                 LOG(Formats, Warning) << "Invalid plane index, stride is zero";
>                 return 0;
>         }
> -- 
> 2.34.1
>


More information about the libcamera-devel mailing list