fix for use after free in case of double unmap

This commit is contained in:
coco
2015-10-21 22:25:49 +02:00
parent cf727ad323
commit dd56621bbb
3 changed files with 53 additions and 1 deletions

2
uc.c
View File

@@ -814,7 +814,7 @@ MemoryRegion *memory_mapping(struct uc_struct* uc, uint64_t address)
// try with the cache index first
i = uc->mapped_block_cache_index;
if (address >= uc->mapped_blocks[i]->addr && address < uc->mapped_blocks[i]->end)
if (i < uc->mapped_block_count && address >= uc->mapped_blocks[i]->addr && address < uc->mapped_blocks[i]->end)
return uc->mapped_blocks[i];
for(i = 0; i < uc->mapped_block_count; i++) {