move memory_overlap() around from mem_map() to mem_map_check(). this fixes test_mem_map.c in issue #420

This commit is contained in:
Nguyen Anh Quynh 2016-02-11 17:53:51 +08:00
parent 07e8f2f60d
commit 5719481e3f

9
uc.c
View file

@ -622,10 +622,6 @@ static uc_err mem_map(uc_engine *uc, uint64_t address, size_t size, uint32_t per
{
MemoryRegion **regions;
// this area overlaps existing mapped regions?
if (memory_overlap(uc, address, size))
return UC_ERR_MAP;
if (block == NULL)
return UC_ERR_NOMEM;
@ -666,6 +662,11 @@ static uc_err mem_map_check(uc_engine *uc, uint64_t address, size_t size, uint32
if ((perms & ~UC_PROT_ALL) != 0)
return UC_ERR_ARG;
// this area overlaps existing mapped regions?
if (memory_overlap(uc, address, size)) {
return UC_ERR_MAP;
}
return UC_ERR_OK;
}