From f607530faf94bcee975a54042d817e9705a4dba1 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 7 Jun 2013 19:20:32 -0700 Subject: QUrl stringprep: fix handling of U+0080: it's prohibited Edge case: a > that should have been >=. Without it, we never ran the rest of the IDN nameprepping. (cherry-picked from qtbase commit 4d93393a6de2d6631979df2bc6d12aa43781dc6f) Change-Id: I2276d660de3a70d0c561bb18816820d9a0f47e77 Reviewed-by: Konstantin Ritt --- src/corelib/io/qurl.cpp | 2 +- tests/auto/qurl/tst_qurl.cpp | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp index af0dfa7..779dbb5 100644 --- a/src/corelib/io/qurl.cpp +++ b/src/corelib/io/qurl.cpp @@ -2975,7 +2975,7 @@ void qt_nameprep(QString *source, int from) for ( ; out < e; ++out) { register ushort uc = out->unicode(); - if (uc > 0x80) { + if (uc >= 0x80) { break; } else if (uc >= 'A' && uc <= 'Z') { *out = QChar(uc | 0x20); diff --git a/tests/auto/qurl/tst_qurl.cpp b/tests/auto/qurl/tst_qurl.cpp index cd696e4..19306fa 100644 --- a/tests/auto/qurl/tst_qurl.cpp +++ b/tests/auto/qurl/tst_qurl.cpp @@ -3067,6 +3067,11 @@ void tst_QUrl::nameprep_testsuite_data() << QString::fromUtf8("\x10\x7F") << QString() << 0 << 0; + QTest::newRow("Non-ASCII 8bit control character U+0080") + << QString::fromUtf8("x\xC2\x80x") + << QString() + << QString("Nameprep") << 0 << STRINGPREP_CONTAINS_PROHIBITED; + QTest::newRow("Non-ASCII 8bit control character U+0085") << QString::fromUtf8("x\xC2\x85x") << QString() -- cgit v0.12