|
|
@@ -1642,7 +1642,7 @@ int main( int argc, const char ** argv )
|
|
|
|
|
|
static const char* result = "\xef\xbb\xbf<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
|
|
|
XMLTest( "BOM and default declaration", result, printer.CStr(), false );
|
|
|
- XMLTest( "CStrSize", 42, printer.CStrSize(), false );
|
|
|
+ XMLTest( "CStrSize", true, printer.CStrSize() == 42, false );
|
|
|
}
|
|
|
{
|
|
|
const char* xml = "<ipxml ws='1'><info bla=' /></ipxml>";
|
|
|
@@ -2666,6 +2666,35 @@ int main( int argc, const char ** argv )
|
|
|
doc.PrintError();
|
|
|
}
|
|
|
|
|
|
+ // ---------- CVE-2024-50615 -----------
|
|
|
+ {
|
|
|
+ const char* xml = "<Hello value='12A34' value2='56B78'>Text</Hello>";
|
|
|
+ XMLDocument doc;
|
|
|
+ doc.Parse(xml);
|
|
|
+ const char* value = doc.FirstChildElement()->Attribute("value");
|
|
|
+ const char* value2 = doc.FirstChildElement()->Attribute("value2");
|
|
|
+ XMLTest("Test attribute encode", false, doc.Error());
|
|
|
+ XMLTest("Test decimal value", value, "12A34");
|
|
|
+ XMLTest("Test hex encode", value2, "56B78");
|
|
|
+ }
|
|
|
+
|
|
|
+ {
|
|
|
+ const char* xml = "<Hello value='&#ABC9000000065;' value2='�' value3='�' value4='E' value5='!'>Text</Hello>";
|
|
|
+ XMLDocument doc;
|
|
|
+ doc.Parse(xml);
|
|
|
+ const char* value = doc.FirstChildElement()->Attribute("value");
|
|
|
+ const char* value2 = doc.FirstChildElement()->Attribute("value2");
|
|
|
+ const char* value3 = doc.FirstChildElement()->Attribute("value3");
|
|
|
+ const char* value4 = doc.FirstChildElement()->Attribute("value4");
|
|
|
+ const char* value5 = doc.FirstChildElement()->Attribute("value5");
|
|
|
+ XMLTest("Test attribute encode", false, doc.Error());
|
|
|
+ XMLTest("Test attribute encode too long value", value, "&#ABC9000000065;"); // test long value
|
|
|
+ XMLTest("Test attribute encode out of unicode range", value2, "�"); // out of unicode range
|
|
|
+ XMLTest("Test attribute encode out of int max value", value3, "�"); // out of int max value
|
|
|
+ XMLTest("Test attribute encode with a Hex value", value4, "E"); // hex value in unicode value
|
|
|
+ XMLTest("Test attribute encode with a Hex value", value5, "!"); // hex value in unicode value
|
|
|
+ }
|
|
|
+
|
|
|
// ----------- Performance tracking --------------
|
|
|
{
|
|
|
#if defined( _MSC_VER )
|