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

Signed-off-by: laiguizhong <laiguizhong@huawei.com>
Change-Id: I81dbe3f13087e280c60a1e6c8b4e825e0c09de3d
This commit is contained in:
laiguizhong 2022-07-25 01:41:56 -07:00
parent 7fb8488f21
commit d0d2e56dad
2 changed files with 5 additions and 1 deletions

View File

@ -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)

View File

@ -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) \