diff options
author | michi_cc <michi_cc@openttd.org> | 2011-09-02 20:54:51 +0000 |
---|---|---|
committer | michi_cc <michi_cc@openttd.org> | 2011-09-02 20:54:51 +0000 |
commit | f227e90c248b37fe50c9e48a08a1bb976c782e9f (patch) | |
tree | 08d88d27ff581ebc89f0f16acb35d156ad6a84be /src/misc/blob.hpp | |
parent | 65637d89411e96dee5ee9fc2e8a7b3805c4162a2 (diff) | |
download | openttd-f227e90c248b37fe50c9e48a08a1bb976c782e9f.tar.xz |
(svn r22875) -Codechange: Add some asserts and checks to better prevent overflow of the argument to malloc. (monoid)
Diffstat (limited to 'src/misc/blob.hpp')
-rw-r--r-- | src/misc/blob.hpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/misc/blob.hpp b/src/misc/blob.hpp index bd83904ea..94459a365 100644 --- a/src/misc/blob.hpp +++ b/src/misc/blob.hpp @@ -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 */ |