From f029782b4ff02abfa19dbe50246f43597e713dad Mon Sep 17 00:00:00 2001 From: shufewhx Date: Thu, 13 Apr 2023 04:12:06 +0000 Subject: [PATCH] fixed 69e3508 from https://gitee.com/shufewhx/communication_ipc_lite/pulls/12 fix bluescreen problem Signed-off-by: shufewhx --- frameworks/liteipc/src/liteipc_adapter.c | 2 +- frameworks/liteipc_linux/src/liteipc_adapter.c | 6 +++--- interfaces/kits/liteipc_adapter.h | 3 ++- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/frameworks/liteipc/src/liteipc_adapter.c b/frameworks/liteipc/src/liteipc_adapter.c index 67d9422..795f541 100755 --- a/frameworks/liteipc/src/liteipc_adapter.c +++ b/frameworks/liteipc/src/liteipc_adapter.c @@ -398,7 +398,7 @@ static int32_t CheckIpcIo(IpcIo* data) return LITEIPC_EINVAL; } totalSize = data->bufferCur - data->bufferBase + ((char*)data->offsetsCur - (char*)data->offsetsBase); - if (totalSize > IPC_IO_DATA_MAX) { + if (totalSize > IPC_IO_BIG_MAX) { LOG(ERROR, "IpcIo data too big, please use IpcIoPushDataBuff to push big data."); return LITEIPC_EINVAL; } diff --git a/frameworks/liteipc_linux/src/liteipc_adapter.c b/frameworks/liteipc_linux/src/liteipc_adapter.c index 197731e..c28635d 100644 --- a/frameworks/liteipc_linux/src/liteipc_adapter.c +++ b/frameworks/liteipc_linux/src/liteipc_adapter.c @@ -47,7 +47,7 @@ static uint32_t g_handle = 0; static bool g_isStartLoop = false; __thread const IpcContext *g_tlsContext = NULL; __thread IpcIo **g_tlsReply = NULL; -__thread uint8_t g_tlsReplyData[IPC_IO_DATA_MAX] = {0}; +__thread uint8_t g_tlsReplyData[IPC_IO_BIG_MAX] = {0}; bool g_init = 0; struct TransactData { uint32_t cmd; @@ -219,7 +219,7 @@ static int32_t CheckIpcIo(IpcIo* data) return LITEIPC_EINVAL; } totalSize = data->bufferCur- data->bufferBase + ((char*)data->offsetsCur - (char*)data->offsetsBase); - if (totalSize > IPC_IO_DATA_MAX) { + if (totalSize > IPC_IO_BIG_MAX) { LOG(ERROR, "IpcIo data too big, please use IpcIoPushDataBuff to push big data."); return LITEIPC_EINVAL; } @@ -841,7 +841,7 @@ int32_t SendReply(const IpcContext* context, void* ipcMsg, IpcIo* reply) size_t objectsSize = tmp.offsetsLeft * sizeof(size_t); (*g_tlsReply)->bufferCur = (*g_tlsReply)->bufferBase = (char*)g_tlsReplyData + objectsSize; (*g_tlsReply)->offsetsCur = (*g_tlsReply)->offsetsBase = (size_t*)g_tlsReplyData; - memcpy_s((*g_tlsReply)->bufferBase, IPC_IO_DATA_MAX, tmp.bufferBase, tmp.bufferLeft); + memcpy_s((*g_tlsReply)->bufferBase, IPC_IO_BIG_MAX, tmp.bufferBase, tmp.bufferLeft); memcpy_s((*g_tlsReply)->offsetsBase, objectsSize, tmp.offsetsBase, objectsSize); (*g_tlsReply)->bufferLeft = tmp.bufferLeft; (*g_tlsReply)->offsetsLeft = tmp.offsetsLeft; diff --git a/interfaces/kits/liteipc_adapter.h b/interfaces/kits/liteipc_adapter.h index bf09115..3048546 100755 --- a/interfaces/kits/liteipc_adapter.h +++ b/interfaces/kits/liteipc_adapter.h @@ -35,7 +35,8 @@ extern "C" { #define IPC_WAIT_FOREVER 0XFFFFFFFF #define IPC_TIMEOUT_MIN 10 /* unit:ms */ #define IPC_INVAILD_TIMER_ID (timer_t)-1 -#define IPC_IO_DATA_MAX 64512UL +#define IPC_IO_DATA_MAX 8192UL +#define IPC_IO_BIG_MAX (42 * 1024UL) typedef enum { LITEIPC_FLAG_DEFAULT = 0, // send and reply -- Gitee