From 22bf38351954137ff17e9a314f8847ee1fd00234 Mon Sep 17 00:00:00 2001 From: Ievgenii Meshcheriakov Date: Tue, 10 Aug 2021 14:57:52 +0200 Subject: tst_qurlinternal: Add another Punycode overflow test The test string "xn--l0902716a" encodes 2**32. Currently the IDNA code returns an empty string when encoding this to Unicode instead of expected original string. Task-number: QTBUG-95689 Pick-to: 6.2 Change-Id: I5ce7bcc744c9d5426f66b8a7d0ae76c7c92f552b Reviewed-by: Edward Welbourne --- tests/auto/corelib/io/qurlinternal/tst_qurlinternal.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'tests/auto/corelib/io') diff --git a/tests/auto/corelib/io/qurlinternal/tst_qurlinternal.cpp b/tests/auto/corelib/io/qurlinternal/tst_qurlinternal.cpp index 1b4f6462b2..6a55295f4b 100644 --- a/tests/auto/corelib/io/qurlinternal/tst_qurlinternal.cpp +++ b/tests/auto/corelib/io/qurlinternal/tst_qurlinternal.cpp @@ -684,6 +684,9 @@ void tst_QUrlInternal::ace_testsuite_data() badRow("punycode-overflow-1", "xn--5p32g"); // Decodes to the same string as "xn--097c" in some versions, see QTBUG-95689 badRow("punycode-overflow-2", "xn--400595c"); + + // Encodes 2**32, decodes to empty string in some versions + badRow("punycode-overflow-3", "xn--l0902716a"); } void tst_QUrlInternal::ace_testsuite() @@ -702,6 +705,7 @@ void tst_QUrlInternal::ace_testsuite() QCOMPARE(QString::fromLatin1(QUrl::toAce(domain)), toace + suffix); QEXPECT_FAIL("punycode-overflow-2", "QTBUG-95689: Missing oweflow check in punycode decoder", Abort); + QEXPECT_FAIL("punycode-overflow-3", "QTBUG-95689: Returns empty string", Abort); if (fromace != ".") QCOMPARE(QUrl::fromAce(domain.toLatin1()), fromace + suffix); QCOMPARE(QUrl::fromAce(QUrl::toAce(domain)), unicode + suffix); -- cgit v1.2.3