summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJay Freeman (saurik) <saurik@saurik.com>2016-08-27 00:50:40 -0700
committerJay Freeman (saurik) <saurik@saurik.com>2016-08-27 00:50:40 -0700
commit4f63b59016d6952f0ddf408a3b1be97f10febc13 (patch)
tree2c3bccbbcec8576771ab56236619b58ae0af0980
parent10ca2b00cab7b80e2275a41fe11205676ee65ead (diff)
downloadldid-4f63b59016d6952f0ddf408a3b1be97f10febc13.tar.gz
ldid-4f63b59016d6952f0ddf408a3b1be97f10febc13.tar.zst
ldid-4f63b59016d6952f0ddf408a3b1be97f10febc13.zip
Add guarantee that allocations shouldn't overflow.
-rw-r--r--ldid.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/ldid.cpp b/ldid.cpp
index 0c70b40..a4dc725 100644
--- a/ldid.cpp
+++ b/ldid.cpp
@@ -1171,6 +1171,8 @@ static void Allocate(const void *idata, size_t isize, std::streambuf &output, co
size_t saved(save(mach_header, output, allocation.limit_, overlap, top));
if (allocation.alloc_ > saved)
pad(output, allocation.alloc_ - saved);
+ else
+ _assert(allocation.alloc_ == saved);
position += allocation.alloc_;
}
}