Merge 7b39f236b9623c396c37e08a326efcc403704590 on remote branch
Change-Id: Ifc994f908667eeeca21583117539893bbcd58470
diff --git a/ipc/HwBinders/agm_ipc_service/src/agm_server_wrapper.cpp b/ipc/HwBinders/agm_ipc_service/src/agm_server_wrapper.cpp
index aa640c4..c98ce8c 100644
--- a/ipc/HwBinders/agm_ipc_service/src/agm_server_wrapper.cpp
+++ b/ipc/HwBinders/agm_ipc_service/src/agm_server_wrapper.cpp
@@ -28,7 +28,7 @@
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* Changes from Qualcomm Innovation Center are provided under the following license:
- * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted (subject to the limitations in the
@@ -1643,18 +1643,26 @@
buf.addr = nullptr;
buf.metadata = nullptr;
- bufSize = buff_hidl.data()->size;
+ if (1 != buff_hidl.size()) {
+ ALOGE("%s: buff_hidl size is not equal to 1.", __func__);
+ goto exit;
+ }
+ bufSize = buff_hidl[0].size;
buf.addr = (uint8_t *)calloc(1, bufSize);
if (!buf.addr) {
ALOGE("%s: failed to calloc", __func__);
goto exit;
}
+ if (bufSize != buff_hidl[0].buffer.size()) {
+ ALOGE("%s: Invalid buffer vector size", __func__);
+ goto exit;
+ }
buf.size = (size_t)bufSize;
- buf.timestamp = buff_hidl.data()->timestamp;
- buf.flags = buff_hidl.data()->flags;
+ buf.timestamp = buff_hidl[0].timestamp;
+ buf.flags = buff_hidl[0].flags;
if (bufSize)
- memcpy(buf.addr, buff_hidl.data()->buffer.data(), bufSize);
+ memcpy(buf.addr, buff_hidl[0].buffer.data(), bufSize);
else {
ALOGE("%s: buf size is null", __func__);
goto exit;