提交 d0d2e56d 编写于 作者: L laiguizhong

解决SystemGetParameterCommitId接口fuzzy测试会引起sigbus问题

Signed-off-by: Nlaiguizhong <laiguizhong@huawei.com>
Change-Id: I81dbe3f13087e280c60a1e6c8b4e825e0c09de3d
上级 7fb8488f
......@@ -72,7 +72,10 @@ INIT_LOCAL_API ParamTrieNode *GetTrieNodeByHandle(ParamHandle handle)
WorkSpace *workSpace = HASHMAP_ENTRY(node, WorkSpace, hashNode);
WORKSPACE_RW_UNLOCK(*paramSpace);
index = index - workSpace->area->startIndex;
return (ParamTrieNode *)GetTrieNode(workSpace, index);
if (PARAM_IS_ALIGNED(index)) {
return (ParamTrieNode *)GetTrieNode(workSpace, index);
}
return NULL;
}
INIT_LOCAL_API WorkSpace *GetFirstWorkSpace(void)
......
......@@ -49,6 +49,7 @@ typedef struct cmdLineInfo {
#define UNUSED(x) (void)(x)
#endif
#define PARAM_ALIGN(len) (((len) + 0x03) & (~0x03))
#define PARAM_IS_ALIGNED(x) (((x) & 0x03) == 0)
#define PARAM_ENTRY(ptr, type, member) (type *)((char *)(ptr)-offsetof(type, member))
#define IS_READY_ONLY(name) \
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册