mirror of https://github.com/AxioDL/tinyxml2.git
Better asserts in parsing
This commit is contained in:
parent
b53aaa885d
commit
3dc797b2a4
|
@ -397,8 +397,8 @@ const char* XMLUtil::GetCharacterRef( const char* p, char* value, int* length )
|
||||||
else {
|
else {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
TIXMLASSERT( digit >= 0 && digit < 16);
|
||||||
TIXMLASSERT( digit == 0 || mult <= UINT_MAX / digit );
|
TIXMLASSERT( digit == 0 || mult <= UINT_MAX / digit );
|
||||||
TIXMLASSERT( digit >= 0 && digit < 16);
|
|
||||||
const unsigned int digitScaled = mult * digit;
|
const unsigned int digitScaled = mult * digit;
|
||||||
TIXMLASSERT( ucs <= ULONG_MAX - digitScaled );
|
TIXMLASSERT( ucs <= ULONG_MAX - digitScaled );
|
||||||
ucs += digitScaled;
|
ucs += digitScaled;
|
||||||
|
@ -427,6 +427,7 @@ const char* XMLUtil::GetCharacterRef( const char* p, char* value, int* length )
|
||||||
while ( *q != '#' ) {
|
while ( *q != '#' ) {
|
||||||
if ( *q >= '0' && *q <= '9' ) {
|
if ( *q >= '0' && *q <= '9' ) {
|
||||||
const unsigned int digit = *q - '0';
|
const unsigned int digit = *q - '0';
|
||||||
|
TIXMLASSERT( digit >= 0 && digit < 10);
|
||||||
TIXMLASSERT( digit == 0 || mult <= UINT_MAX / digit );
|
TIXMLASSERT( digit == 0 || mult <= UINT_MAX / digit );
|
||||||
const unsigned int digitScaled = mult * digit;
|
const unsigned int digitScaled = mult * digit;
|
||||||
TIXMLASSERT( ucs <= ULONG_MAX - digitScaled );
|
TIXMLASSERT( ucs <= ULONG_MAX - digitScaled );
|
||||||
|
|
Loading…
Reference in New Issue