From 7265b763fcf3e0b2a26564f9b2b79bb591157dc3 Mon Sep 17 00:00:00 2001 From: Lee Thomason Date: Sun, 15 Mar 2015 16:11:47 -0700 Subject: [PATCH] merge change; add extra assert --- tinyxml2.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tinyxml2.cpp b/tinyxml2.cpp index 32ad143..66fa560 100755 --- a/tinyxml2.cpp +++ b/tinyxml2.cpp @@ -374,7 +374,8 @@ const char* XMLUtil::GetCharacterRef( const char* p, char* value, int* length ) --q; while ( *q != 'x' ) { - unsigned int digit; + unsigned int digit = 0; + if ( *q >= '0' && *q <= '9' ) { digit = *q - '0'; } @@ -388,6 +389,7 @@ const char* XMLUtil::GetCharacterRef( const char* p, char* value, int* length ) return 0; } TIXMLASSERT( digit == 0 || mult <= UINT_MAX / digit ); + TIXMLASSERT( digit >= 0 && digit < 16); const unsigned int digitScaled = mult * digit; TIXMLASSERT( ucs <= ULONG_MAX - digitScaled ); ucs += digitScaled;