[PATCH 1/2] libcamera: formats: Fix planes bounds check
Laurent Pinchart
laurent.pinchart at ideasonboard.com
Mon Feb 26 11:06:09 CET 2024
On Mon, Feb 26, 2024 at 12:02:07PM +0200, Laurent Pinchart wrote:
> On Mon, Feb 26, 2024 at 09:56:49AM +0000, Kieran Bingham wrote:
> > 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 ?
>
> If there's no usable e-mail address, I'd just drop the reporter. The
> main point of the Reported-by tag is (in my opinion) to be able to
> contact the reporter to get more information. In this case the problem
> is trivial, so there's no big value in reporter information.
With this fixed,
Reviewed-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
> > > 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;
> > > }
--
Regards,
Laurent Pinchart
More information about the libcamera-devel
mailing list