Skip to content

Commit

Permalink
move memory_overlap() around from mem_map() to mem_map_check(). this …
Browse files Browse the repository at this point in the history
…fixes test_mem_map.c in issue #420
  • Loading branch information
aquynh committed Feb 11, 2016
1 parent 07e8f2f commit 5719481
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions uc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit 5719481

Please sign in to comment.