From 74fb870c367dc61da80f565910d36910e3f40b5f Mon Sep 17 00:00:00 2001 From: Dmitry-Me Date: Tue, 13 Jan 2015 10:27:36 +0300 Subject: [PATCH] More overflow checks --- tinyxml2.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tinyxml2.h b/tinyxml2.h index 79af682..1f6c833 100755 --- a/tinyxml2.h +++ b/tinyxml2.h @@ -232,11 +232,14 @@ public: } void Push( T t ) { + TIXMLASSERT( _size < (size_t)(-1) ); EnsureCapacity( _size+1 ); _mem[_size++] = t; } T* PushArr( int count ) { + TIXMLASSERT( count >= 0 ); + TIXMLASSERT( _size <= (size_t)(-1) - count ); EnsureCapacity( _size+count ); T* ret = &_mem[_size]; _size += count; @@ -244,6 +247,7 @@ public: } T Pop() { + TIXMLASSERT( _size > 0 ); return _mem[--_size]; }