(svn r22875) -Codechange: Add some asserts and checks to better prevent overflow of the argument to malloc. (monoid)

This commit is contained in:
michi_cc
2011-09-02 20:54:51 +00:00
parent 65637d8941
commit f227e90c24
6 changed files with 22 additions and 1 deletions

View File

@@ -260,6 +260,7 @@ public:
if (Capacity() >= new_size) return;
/* calculate minimum block size we need to allocate
* and ask allocation policy for some reasonable block size */
assert(new_size < SIZE_MAX - header_size - tail_reserve);
new_size = AllocPolicy(header_size + new_size + tail_reserve);
/* allocate new block and setup header */