1
0
mirror of https://github.com/leethomason/tinyxml2.git synced 2026-07-21 19:23:00 +04:00

fix comments. review

This commit is contained in:
Lee Thomason
2026-05-23 16:30:11 -07:00
parent 543333f89f
commit d1a1115c45
+3 -3
View File
@@ -2704,7 +2704,7 @@ int main( int argc, const char ** argv )
// ---------- Security: numeric character reference bounds ---------- // ---------- Security: numeric character reference bounds ----------
{ {
// Regression: U+10FFFF is the last valid Unicode code point and must // Regression: U+10FFFF is the last valid Unicode code point and must
// parse correctly. Fix #2 must not reject the maximum valid value. // parse correctly. The in-loop overflow guard must not reject it.
XMLDocument doc; XMLDocument doc;
doc.Parse( "<t v='&#x10FFFF;'/>" ); doc.Parse( "<t v='&#x10FFFF;'/>" );
XMLTest( "Numeric ref U+10FFFF: no error", false, doc.Error() ); XMLTest( "Numeric ref U+10FFFF: no error", false, doc.Error() );
@@ -2717,7 +2717,7 @@ int main( int argc, const char ** argv )
XMLTest( "Numeric ref U+10FFFF: correct UTF-8 output", expected, v ); XMLTest( "Numeric ref U+10FFFF: correct UTF-8 output", expected, v );
} }
{ {
// Fix #2 boundary: U+110000 is one above the maximum code point. // Boundary check: U+110000 is one above the maximum code point.
// The in-loop overflow guard must catch this before ucs is written, // The in-loop overflow guard must catch this before ucs is written,
// leaving the entity as a literal (starting with '&'). // leaving the entity as a literal (starting with '&').
XMLDocument doc; XMLDocument doc;
@@ -2728,7 +2728,7 @@ int main( int argc, const char ** argv )
v != nullptr && v[0] == '&' ); v != nullptr && v[0] == '&' );
} }
{ {
// Fix #2: a hex entity with enough digits to overflow uint32_t must // A hex entity with enough digits to overflow uint32_t must
// be rejected by the in-loop guard before the accumulator wraps. // be rejected by the in-loop guard before the accumulator wraps.
// Before the fix, ucs could wrap around and pass the post-loop range // Before the fix, ucs could wrap around and pass the post-loop range
// check, producing an attacker-chosen character in the parsed output. // check, producing an attacker-chosen character in the parsed output.