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:
parent
32488fc30d
commit
2f6f874e17
1 changed files with 8 additions and 0 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue