From 62b5d88b0d62eaba2e94c0dcf1dc3d0be719ee6b Mon Sep 17 00:00:00 2001 From: Ievgenii Meshcheriakov Date: Mon, 9 Aug 2021 18:34:57 +0200 Subject: tst_qurlinternal: Add tests for punycode overflow Add two tests for decoding IDNs when they encode values outside Unicode (> 0x110000). "xn--5p32g" decodes to "a" (all ASCII) before QTBUG-95577 got fixed. "xn--400595c" decodes to the same value as "xn--097c" after the above mentioned bug got fixed. This test is currently failing. Task-number: QTBUG-95689 Pick-to: 6.2 Change-Id: Icab55c41e0233b34d57e38232fa90ac42f35a50a Reviewed-by: Thiago Macieira Reviewed-by: Edward Welbourne --- tests/auto/corelib/io/qurlinternal/tst_qurlinternal.cpp | 13 +++++++++++++ 1 file changed, 13 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 7f2c506a1a..50799f0ab4 100644 --- a/tests/auto/corelib/io/qurlinternal/tst_qurlinternal.cpp +++ b/tests/auto/corelib/io/qurlinternal/tst_qurlinternal.cpp @@ -675,6 +675,17 @@ void tst_QUrlInternal::ace_testsuite_data() QTest::newRow("invalid-nameprep-unassigned") << "xn--s5a" << "xn--s5a" << "xn--s5a" << "xn--s5a"; // same character, see QTBUG-60364 QTest::newRow("invalid-nameprep-unassigned2") << "xn--80ak6aa92e" << "xn--80ak6aa92e" << "xn--80ak6aa92e" << "xn--80ak6aa92e"; + + // Decodes to "a" in some versions, see QTBUG-95689 + QTest::newRow("punycode-overflow-1") << "xn--5p32g" + << "xn--5p32g" + << "xn--5p32g" + << "xn--5p32g"; + // Decodes to the same string as "xn--097c" in some versions, see QTBUG-95689 + QTest::newRow("punycode-overflow-2") << "xn--400595c" + << "xn--400595c" + << "xn--400595c" + << "xn--400595c"; } void tst_QUrlInternal::ace_testsuite() @@ -691,6 +702,8 @@ void tst_QUrlInternal::ace_testsuite() QString domain = in + suffix; QCOMPARE(QString::fromLatin1(QUrl::toAce(domain)), toace + suffix); + QEXPECT_FAIL("punycode-overflow-2", "QTBUG-95689: Missing oweflow check in punycode decoder", + Abort); if (fromace != ".") QCOMPARE(QUrl::fromAce(domain.toLatin1()), fromace + suffix); QCOMPARE(QUrl::fromAce(QUrl::toAce(domain)), unicode + suffix); -- cgit v1.2.3