mirror of
https://github.com/Evolution-X/hardware_interfaces
synced 2026-02-01 16:50:18 +00:00
Validate request metadata before coverting to camera metadata
- Backport similar fix from AIDL to HIDL to protect from malformed metadata Bug: 256166626 Test: CTS test Change-Id: If8f83520144824e38ed102b7468d6d5ee2e6d963
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
|
||||
#define LOG_TAG "android.hardware.camera.device@3.2-convert-impl"
|
||||
#include <log/log.h>
|
||||
#include <system/camera_metadata.h>
|
||||
|
||||
#include "include/convert.h"
|
||||
|
||||
@@ -43,6 +44,13 @@ bool convertFromHidl(const CameraMetadata &src, const camera_metadata_t** dst) {
|
||||
ALOGE("%s: input CameraMetadata is corrupt!", __FUNCTION__);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (validate_camera_metadata_structure((camera_metadata_t*)data, /*expected_size=*/NULL) !=
|
||||
OK) {
|
||||
ALOGE("%s: Failed to validate the metadata structure", __FUNCTION__);
|
||||
return false;
|
||||
}
|
||||
|
||||
*dst = (camera_metadata_t*) data;
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user