1Description: TinyXML incorrectly encodes text element containing 2 an ampersand followed by either x or #. 3 4Origin: http://sourceforge.net/tracker/index.php?func=detail&aid=3031828&group_id=13559&atid=313559 5 6Upstream-Status: Pending 7 8diff -u -r1.105 tinyxml.cpp 9--- a/tinyxml.cpp 10+++ b/tinyxml.cpp 11@@ -57,30 +57,7 @@ 12 { 13 unsigned char c = (unsigned char) str[i]; 14 15- if ( c == '&' 16- && i < ( (int)str.length() - 2 ) 17- && str[i+1] == '#' 18- && str[i+2] == 'x' ) 19- { 20- // Hexadecimal character reference. 21- // Pass through unchanged. 22- // © -- copyright symbol, for example. 23- // 24- // The -1 is a bug fix from Rob Laveaux. It keeps 25- // an overflow from happening if there is no ';'. 26- // There are actually 2 ways to exit this loop - 27- // while fails (error case) and break (semicolon found). 28- // However, there is no mechanism (currently) for 29- // this function to return an error. 30- while ( i<(int)str.length()-1 ) 31- { 32- outString->append( str.c_str() + i, 1 ); 33- ++i; 34- if ( str[i] == ';' ) 35- break; 36- } 37- } 38- else if ( c == '&' ) 39+ if ( c == '&' ) 40 { 41 outString->append( entity[0].str, entity[0].strLength ); 42 ++i; 43diff -u -r1.89 xmltest.cpp 44--- a/xmltest.cpp 45+++ b/xmltest.cpp 46@@ -1340,6 +1340,16 @@ 47 }*/ 48 } 49 50+ #ifdef TIXML_USE_STL 51+ { 52+ TiXmlDocument xml; 53+ xml.Parse("<foo>foo&#xa+bar</foo>"); 54+ std::string str; 55+ str << xml; 56+ XmlTest( "Entity escaping", "<foo>foo&#xa+bar</foo>", str.c_str() ); 57+ } 58+ #endif 59+ 60 /* 1417717 experiment 61 { 62 TiXmlDocument xml; 63