Message ID | 20210416134347.2881373-2-hiroh@chromium.org |
---|---|
State | Rejected |
Headers | show |
Series |
|
Related | show |
Hi Hiro, Thank you for the patch. On Fri, Apr 16, 2021 at 10:43:47PM +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> > Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> I think you can squash this with the previous patch. I wonder, however, what errors you expect this to catch. When can we receive an invalid buffer handle from the camera service ? > --- > 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;
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;