diff options
author | Kieran Bingham <kieran.bingham@ideasonboard.com> | 2024-02-26 09:48:56 +0000 |
---|---|---|
committer | Kieran Bingham <kieran.bingham@ideasonboard.com> | 2024-02-28 11:09:02 +0000 |
commit | 25a8d8b8a914302f1de02af4b0f5ae70568f00ea (patch) | |
tree | 4f49ea34caefa8a78a309cedd47ee97f624894d6 | |
parent | 26d9e36d3e057b91b5b1b161a38f23f19a0590e5 (diff) |
libcamera: formats: Fix planes bounds check
The plane validation in the stride helper incorrectly accepts the number
of planes as a plane index. Fix the off by one issue.
Fixes: e83727a194b5 ("libcamera: PixelFormatInfo: Add functions stride and frameSize")
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
-rw-r--r-- | src/libcamera/formats.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/libcamera/formats.cpp b/src/libcamera/formats.cpp index 6a3b89a3..955c3fba 100644 --- a/src/libcamera/formats.cpp +++ b/src/libcamera/formats.cpp @@ -997,7 +997,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; } |