diff options
Diffstat (limited to 'extra/yassl/taocrypt/include/block.hpp')
-rw-r--r-- | extra/yassl/taocrypt/include/block.hpp | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/extra/yassl/taocrypt/include/block.hpp b/extra/yassl/taocrypt/include/block.hpp index 13f712ea045..77017e9d5e4 100644 --- a/extra/yassl/taocrypt/include/block.hpp +++ b/extra/yassl/taocrypt/include/block.hpp @@ -12,8 +12,9 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + along with this program; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + MA 02110-1301 USA. */ @@ -60,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)); - } }; @@ -100,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]; @@ -143,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; } |