aboutsummaryrefslogtreecommitdiff
path: root/unicorn_mode/helper_scripts
diff options
context:
space:
mode:
Diffstat (limited to 'unicorn_mode/helper_scripts')
-rw-r--r--unicorn_mode/helper_scripts/unicorn_loader.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/unicorn_mode/helper_scripts/unicorn_loader.py b/unicorn_mode/helper_scripts/unicorn_loader.py
index 740af1c8..cef39f7e 100644
--- a/unicorn_mode/helper_scripts/unicorn_loader.py
+++ b/unicorn_mode/helper_scripts/unicorn_loader.py
@@ -148,6 +148,9 @@ class UnicornSimpleHeap(object):
return new_chunk_addr
def free(self, addr):
+ if addr == 0:
+ return False
+
for chunk in self._chunks:
if chunk.is_buffer_in_chunk(addr, 1):
if self._debug_print:
@@ -159,7 +162,8 @@ class UnicornSimpleHeap(object):
self._uc.mem_unmap(chunk.actual_addr, chunk.total_size)
self._chunks.remove(chunk)
return True
- return False
+ # Freed an object that doesn't exist. Maybe 'dobule-free' or 'invalid free' vulnerability here.
+ self._uc.force_crash(UcError(UC_ERR_FETCH_UNMAPPED))
# Implements basic guard-page functionality
def __check_mem_access(self, uc, access, address, size, value, user_data):