Merge remote-tracking branch 'origin/master'

This commit is contained in:
Lee Thomason 2015-03-15 16:12:51 -07:00
commit 80647bde2e
2 changed files with 23 additions and 5 deletions

View File

@ -228,12 +228,20 @@ const char* StrPair::GetStr()
const int buflen = 10;
char buf[buflen] = { 0 };
int len = 0;
p = const_cast<char*>( XMLUtil::GetCharacterRef( p, buf, &len ) );
char* adjusted = const_cast<char*>( XMLUtil::GetCharacterRef( p, buf, &len ) );
if ( adjusted == 0 ) {
*q = *p;
++p;
++q;
}
else {
TIXMLASSERT( 0 <= len && len <= buflen );
TIXMLASSERT( q + len <= p );
TIXMLASSERT( q + len <= adjusted );
p = adjusted;
memcpy( q, buf, len );
q += len;
}
}
else {
int i=0;
for(; i<NUM_ENTITIES; ++i ) {

View File

@ -1416,6 +1416,16 @@ int main( int argc, const char ** argv )
XMLPrinter printer;
}
{
// Issue 291. Should not crash
const char* xml = "&#0</a>";
XMLDocument doc;
doc.Parse( xml );
XMLPrinter printer;
doc.Print( &printer );
}
// ----------- Performance tracking --------------
{
#if defined( _MSC_VER )