avoid newSize = 0 if maxSize_ = 0

This commit is contained in:
MITSUNARI Shigeo 2013-04-17 11:01:18 +09:00
parent 4f544f03f3
commit 4a04d4f74e

View File

@ -503,7 +503,7 @@ protected:
*/
void growMemory()
{
const size_t newSize = maxSize_ * 2;
const size_t newSize = (std::max<size_t>)(DEFAULT_MAX_CODE_SIZE, maxSize_ * 2);
uint8 *newTop = alloc_->alloc(newSize);
if (newTop == 0) throw ERR_CANT_ALLOC;
for (size_t i = 0; i < size_; i++) newTop[i] = top_[i];