[libcamera-devel] [PATCH] libcamera: pipeline: ipu3: Prevent unintialised memory use
paul.elder at ideasonboard.com
paul.elder at ideasonboard.com
Fri Feb 19 03:40:24 CET 2021
Hi Kiera,
On Thu, Feb 18, 2021 at 01:47:52PM +0000, Kieran Bingham wrote:
> The call to setFormat uses uninitialised data, which whilst
> not necessary a fault while setting, could cause unwanted effects.
>
> It is also trapped and reported by valgrind.
>
> Initialise the V4L2SubdeviceFormat structure correctly before use.
>
> Signed-off-by: Kieran Bingham <kieran.bingham at ideasonboard.com>
With the changes suggested by Jacopo,
Reviewed-by: Paul Elder <paul.elder at ideasonboard.com>
> ---
> src/libcamera/pipeline/ipu3/ipu3.cpp | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp
> index 3e6b88af4188..e2353e890e0f 100644
> --- a/src/libcamera/pipeline/ipu3/ipu3.cpp
> +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp
> @@ -846,7 +846,7 @@ int PipelineHandlerIPU3::initControls(IPU3CameraData *data)
> */
>
> /* Re-fetch the sensor info updated to use the largest resolution. */
> - V4L2SubdeviceFormat sensorFormat;
> + V4L2SubdeviceFormat sensorFormat = {};
> sensorFormat.size = sensor->resolution();
> ret = sensor->setFormat(&sensorFormat);
> if (ret)
> --
> 2.25.1
>
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel at lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel
More information about the libcamera-devel
mailing list