1 Description: TinyXML incorrectly encodes text element containing
2 an ampersand followed by either x or #.
4 Origin: http://sourceforge.net/tracker/index.php?func=detail&aid=3031828&group_id=13559&atid=313559
6 Upstream-Status: Pending
8 diff -u -r1.105 tinyxml.cpp
13 unsigned char c = (unsigned char) str[i];
16 - && i < ( (int)str.length() - 2 )
18 - && str[i+2] == 'x' )
20 - // Hexadecimal character reference.
21 - // Pass through unchanged.
22 - // © -- copyright symbol, for example.
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 )
32 - outString->append( str.c_str() + i, 1 );
34 - if ( str[i] == ';' )
38 - else if ( c == '&' )
41 outString->append( entity[0].str, entity[0].strLength );
43 diff -u -r1.89 xmltest.cpp
46 @@ -1340,6 +1340,16 @@
50 + #ifdef TIXML_USE_STL
53 + xml.Parse("<foo>foo&#xa+bar</foo>");
56 + XmlTest( "Entity escaping", "<foo>foo&#xa+bar</foo>", str.c_str() );