mirror of https://github.com/AxioDL/tinyxml2.git
Merge pull request #275 from Dmitry-Me/moreOverflowChecks
More overflow checks
This commit is contained in:
commit
38b49ae042
|
@ -232,11 +232,14 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
void Push( T t ) {
|
void Push( T t ) {
|
||||||
|
TIXMLASSERT( _size < (size_t)(-1) );
|
||||||
EnsureCapacity( _size+1 );
|
EnsureCapacity( _size+1 );
|
||||||
_mem[_size++] = t;
|
_mem[_size++] = t;
|
||||||
}
|
}
|
||||||
|
|
||||||
T* PushArr( int count ) {
|
T* PushArr( int count ) {
|
||||||
|
TIXMLASSERT( count >= 0 );
|
||||||
|
TIXMLASSERT( _size <= (size_t)(-1) - count );
|
||||||
EnsureCapacity( _size+count );
|
EnsureCapacity( _size+count );
|
||||||
T* ret = &_mem[_size];
|
T* ret = &_mem[_size];
|
||||||
_size += count;
|
_size += count;
|
||||||
|
@ -244,6 +247,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
T Pop() {
|
T Pop() {
|
||||||
|
TIXMLASSERT( _size > 0 );
|
||||||
return _mem[--_size];
|
return _mem[--_size];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue