[libcamera-devel] [PATCH v2 2/2] android: CameraDevice: Validate buffer_handle by CameraBuffer::isValidBuffer()

Jacopo Mondi jacopo at jmondi.org
Wed Apr 7 10:08:54 CEST 2021


Hi Hiro,

On Wed, Apr 07, 2021 at 01:36:20PM +0900, Hirokazu Honda wrote:
> This adds a validation to buffer_handle provided in
> CameraDevice::processCaptureRequest() by using
> CameraBuffer::isValidBuffer().
>
> Signed-off-by: Hirokazu Honda <hiroh at chromium.org>
> ---
>  src/android/camera_device.cpp | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp
> index 89044efa..8a742812 100644
> --- a/src/android/camera_device.cpp
> +++ b/src/android/camera_device.cpp
> @@ -293,6 +293,11 @@ bool isValidRequest(camera3_capture_request_t *camera3Request)
>  				<< ") in buffer " << i;
>  			return false;
>  		}
> +
> +		if (!CameraBuffer::isValidBuffer(handle)) {
> +			LOG(HAL, Error) << "buffer " << i << "is invalid";

s/buffer/Buffer
" is invalid" with a space at the beginning of the string

I would consider moving the error printout to the memory backend
implementation as it could add more details on the failure reason.
However, this is good
Reviewed-by: Jacopo Mondi <jacopo at jmondi.org>

Thanks
  j


> +			return false;
> +		}
>  	}
>
>  	return true;
> --
> 2.31.0.208.g409f899ff0-goog
>
> _______________________________________________
> 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