add check for mem_map(size=0) (#14)
This commit is contained in:
6
uc.c
6
uc.c
@@ -126,6 +126,8 @@ const char *uc_strerror(uc_err code)
|
||||
return "Invalid instruction (UC_ERR_INSN_INVALID)";
|
||||
case UC_ERR_HOOK:
|
||||
return "Invalid hook type (UC_ERR_HOOK)";
|
||||
case UC_ERR_MAP:
|
||||
return "Invalid memory mapping (UC_ERR_MAP)";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -552,6 +554,10 @@ uc_err uc_mem_map(uch handle, uint64_t address, size_t size)
|
||||
// invalid handle
|
||||
return UC_ERR_UCH;
|
||||
|
||||
if (size == 0)
|
||||
// invalid memory mapping
|
||||
return UC_ERR_MAP;
|
||||
|
||||
// align to 8KB boundary
|
||||
map_begin[map_count] = address & (~ (8*1024 - 1));
|
||||
s = (size + 8*1024 - 1) & (~ (8*1024 - 1));
|
||||
|
||||
Reference in New Issue
Block a user