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

Hirokazu Honda hiroh at chromium.org
Fri Apr 16 15:43:47 CEST 2021


This adds a validation to buffer_handle provided in
CameraDevice::processCaptureRequest() by using
CameraBuffer::isValidBuffer().

Signed-off-by: Hirokazu Honda <hiroh at chromium.org>
Reviewed-by: Jacopo Mondi <jacopo at jmondi.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;
+		}
 	}
 
 	return true;
-- 
2.31.1.368.gbe11c130af-goog



More information about the libcamera-devel mailing list