From 508e2c9c45b3f68a8c8ac32878bdede0d07bfa52 Mon Sep 17 00:00:00 2001 From: Neil Hodgson Date: Sat, 4 Jul 2015 08:51:08 +1000 Subject: Throw an exception for a negative sized reallocation as occurs when asked for more than 2GB. --- src/SplitVector.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/SplitVector.h') diff --git a/src/SplitVector.h b/src/SplitVector.h index 288c9e39f..3153700f5 100644 --- a/src/SplitVector.h +++ b/src/SplitVector.h @@ -85,6 +85,9 @@ public: /// copy exisiting contents to the new buffer. /// Must not be used to decrease the size of the buffer. void ReAllocate(int newSize) { + if (newSize < 0) + throw std::runtime_error("SplitVector::ReAllocate: negative size."); + if (newSize > size) { // Move the gap to the end GapTo(lengthBody); -- cgit v1.2.3