From b4f99a4377102da38858f01f07612e05fedb9844 Mon Sep 17 00:00:00 2001 From: Erliangqi Date: Mon, 11 Jul 2022 07:25:41 +0000 Subject: [PATCH] Call StreamOperatorProxy: : GetStreamAttributes crash off (after) process --- .../hdi_ipc/client/src/stream_operator_proxy.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/camera/interfaces/hdi_ipc/client/src/stream_operator_proxy.cpp b/camera/interfaces/hdi_ipc/client/src/stream_operator_proxy.cpp index 6427d3b380..3e99d28878 100644 --- a/camera/interfaces/hdi_ipc/client/src/stream_operator_proxy.cpp +++ b/camera/interfaces/hdi_ipc/client/src/stream_operator_proxy.cpp @@ -17,6 +17,7 @@ #include #include #include +#include #include "istream_operator_callback.h" #include "ioffline_stream_operator.h" #include "camera_metadata_info.h" @@ -207,10 +208,10 @@ CamRetCode StreamOperatorProxy::GetStreamAttributes( int32_t count = reply.ReadInt32(); for (int i = 0; i < count; i++) { const uint8_t *buffer = data.ReadBuffer(sizeof(StreamAttribute)); - std::shared_ptr attribute = - std::shared_ptr( - reinterpret_cast( - const_cast(buffer))); + std::shared_ptr attribute = std::make_shared(); + if (memcpy_s(attribute.get(), sizeof(StreamAttribute), buffer, sizeof(StreamAttribute)) != EOK) { + return INVALID_ARGUMENT; + } attributes.push_back(attribute); } -- Gitee