[libcamera-devel,v3,2/2] android: CameraDevice: Validate buffer_handle by CameraBuffer::isValidBuffer()
diff mbox series

Message ID 20210408031040.1388568-2-hiroh@chromium.org
State Changes Requested
Headers show
Series
  • [libcamera-devel,v3,1/2] android: CameraBuffer: Add a static function to check a buffer validness
Related show

Commit Message

Hirokazu Honda April 8, 2021, 3:10 a.m. UTC
This adds a validation to buffer_handle provided in
CameraDevice::processCaptureRequest() by using
CameraBuffer::isValidBuffer().

Signed-off-by: Hirokazu Honda <hiroh@chromium.org>
---
 src/android/camera_device.cpp | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Jacopo Mondi April 8, 2021, 1:04 p.m. UTC | #1
Hi Hiro,

On Thu, Apr 08, 2021 at 12:10:40PM +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@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..7247c12c 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";
> +			return false;
> +		}

Thanks
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>

Thanks
  j

>  	}
>
>  	return true;
> --
> 2.31.0.208.g409f899ff0-goog
>
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel@lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel

Patch
diff mbox series

diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp
index 89044efa..7247c12c 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";
+			return false;
+		}
 	}
 
 	return true;