summaryrefslogtreecommitdiff
path: root/extra/yassl/taocrypt/include/block.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'extra/yassl/taocrypt/include/block.hpp')
-rw-r--r--extra/yassl/taocrypt/include/block.hpp12
1 files changed, 4 insertions, 8 deletions
diff --git a/extra/yassl/taocrypt/include/block.hpp b/extra/yassl/taocrypt/include/block.hpp
index 9885c44d2c9..77017e9d5e4 100644
--- a/extra/yassl/taocrypt/include/block.hpp
+++ b/extra/yassl/taocrypt/include/block.hpp
@@ -61,10 +61,6 @@ public:
void destroy(pointer p) {p->~T();}
size_type max_size() const {return ~size_type(0)/sizeof(T);}
protected:
- static void CheckSize(size_t n)
- {
- assert(n <= ~size_t(0) / sizeof(T));
- }
};
@@ -101,7 +97,8 @@ public:
pointer allocate(size_type n, const void* = 0)
{
- this->CheckSize(n);
+ if (n > this->max_size())
+ return 0;
if (n == 0)
return 0;
return NEW_TC T[n];
@@ -144,9 +141,8 @@ public:
return *this;
}
- T& operator[] (word32 i) { assert(i < sz_); return buffer_[i]; }
- const T& operator[] (word32 i) const
- { assert(i < sz_); return buffer_[i]; }
+ T& operator[] (word32 i) { return buffer_[i]; }
+ const T& operator[] (word32 i) const { return buffer_[i]; }
T* operator+ (word32 i) { return buffer_ + i; }
const T* operator+ (word32 i) const { return buffer_ + i; }