未验证 提交 1821294e 编写于 作者: O openharmony_ci 提交者: Gitee

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

Merge pull request !973 from Mupceet/master_cc_solve_sigbus
......@@ -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.
先完成此消息的编辑!
想要评论请 注册