summaryrefslogtreecommitdiff
path: root/camera/device/3.4/default/CameraDeviceSession.cpp
diff options
context:
space:
mode:
authorShuzhen Wang <shuzhenwang@google.com>2018-03-09 15:58:43 -0800
committerShuzhen Wang <shuzhenwang@google.com>2018-03-09 16:01:06 -0800
commit17d817a889da6be3f77da83ef0b3547461b4a6a6 (patch)
treed584459e9e51318ff731a37da028a9619abd237d /camera/device/3.4/default/CameraDeviceSession.cpp
parenta3819421700f9a743c8c515029cac798555946f6 (diff)
Camera: Do not forward capture_result in error condition
If HAL calls process_capture_result with invalid buffers, the HIDL wrapper shouldn't forward it to camera service, since the CaptureResult structure may not be completely initialized. Test: Run GoogleCamera Bug: 74433802 Change-Id: Iaf20b542af5b11ffbedf709e99137b69d77a9ad3
Diffstat (limited to 'camera/device/3.4/default/CameraDeviceSession.cpp')
-rw-r--r--camera/device/3.4/default/CameraDeviceSession.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/camera/device/3.4/default/CameraDeviceSession.cpp b/camera/device/3.4/default/CameraDeviceSession.cpp
index b032357676..ad7f6f515e 100644
--- a/camera/device/3.4/default/CameraDeviceSession.cpp
+++ b/camera/device/3.4/default/CameraDeviceSession.cpp
@@ -450,8 +450,12 @@ void CameraDeviceSession::sProcessCaptureResult_3_4(
CameraDeviceSession *d =
const_cast<CameraDeviceSession*>(static_cast<const CameraDeviceSession*>(cb));
- CaptureResult result;
- d->constructCaptureResult(result.v3_2, hal_result);
+ CaptureResult result = {};
+ status_t ret = d->constructCaptureResult(result.v3_2, hal_result);
+ if (ret != OK) {
+ return;
+ }
+
result.physicalCameraMetadata.resize(hal_result->num_physcam_metadata);
for (uint32_t i = 0; i < hal_result->num_physcam_metadata; i++) {
std::string physicalId = hal_result->physcam_ids[i];