aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--unicorn_mode/helper_scripts/unicorn_loader.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/unicorn_mode/helper_scripts/unicorn_loader.py b/unicorn_mode/helper_scripts/unicorn_loader.py
index cef39f7e..d0995f83 100644
--- a/unicorn_mode/helper_scripts/unicorn_loader.py
+++ b/unicorn_mode/helper_scripts/unicorn_loader.py
@@ -101,6 +101,10 @@ class UnicornSimpleHeap(object):
# - Allocate at least 1 4k page of memory to make Unicorn happy
# - Add guard pages at the start and end of the region
total_chunk_size = UNICORN_PAGE_SIZE + ALIGN_PAGE_UP(size) + UNICORN_PAGE_SIZE
+
+ if size == 0:
+ return 0
+
# Gross but efficient way to find space for the chunk:
chunk = None
for addr in range(self.HEAP_MIN_ADDR, self.HEAP_MAX_ADDR, UNICORN_PAGE_SIZE):