diff options
author | Alexander Grishkov <gaws@mail.ru> | 2016-03-15 22:54:20 +0300 |
---|---|---|
committer | Alexander Grishkov <gaws@mail.ru> | 2016-04-08 15:09:50 +0000 |
commit | f39e542eb859f5f88c65a1b97bdf2f4256c68ec0 (patch) | |
tree | 51a3fe9109da7659281313f3800af7256883c369 /tests | |
parent | 8e103902def83af0a074b81c9d527d8147def162 (diff) |
Fix parsing of IPv4 addresses with certain symbols
Add some extra checks to the parser to make sure that addresses
like "300-05" aren't interpreted as valid IPv4 addresses.
Change-Id: I12475eebc9452e060779bb05e2b4ad9512a28281
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/corelib/io/qipaddress/tst_qipaddress.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/auto/corelib/io/qipaddress/tst_qipaddress.cpp b/tests/auto/corelib/io/qipaddress/tst_qipaddress.cpp index 3e16d3b871..0addd89ebf 100644 --- a/tests/auto/corelib/io/qipaddress/tst_qipaddress.cpp +++ b/tests/auto/corelib/io/qipaddress/tst_qipaddress.cpp @@ -186,6 +186,7 @@ void tst_QIpAddress::invalidParseIp4_data() QTest::newRow("..") << ".."; QTest::newRow("...") << "..."; QTest::newRow("....") << "...."; + QTest::newRow(".1.2.3") << ".1.2.3"; QTest::newRow("1.") << "1."; QTest::newRow("1.2.") << "1.2."; QTest::newRow("1.2.3.") << "1.2.3."; @@ -214,9 +215,15 @@ void tst_QIpAddress::invalidParseIp4_data() QTest::newRow("-1.1") << "-1.1"; QTest::newRow("1.-1") << "1.-1"; QTest::newRow("1.1.1.-1") << "1.1.1.-1"; + QTest::newRow("300-05") << "300-05"; + QTest::newRow("127.-1") << "127.-1"; + QTest::newRow("-127-10") << "-127-10"; + QTest::newRow("198.-16") << "198-16"; + QTest::newRow("-127.-0.") << "-127.-0."; // letters QTest::newRow("abc") << "abc"; + QTest::newRow("localhost") << "localhost"; QTest::newRow("1.2.3a.4") << "1.2.3a.4"; QTest::newRow("a.2.3.4") << "a.2.3.4"; QTest::newRow("1.2.3.4a") << "1.2.3.4a"; @@ -249,6 +256,7 @@ void tst_QIpAddress::ip4ToString_data() QTest::newRow("0.0.0.0") << 0u << "0.0.0.0"; QTest::newRow("1.2.3.4") << 0x01020304u << "1.2.3.4"; + QTest::newRow("127.0.0.1") << 0x7f000001u << "127.0.0.1"; QTest::newRow("111.222.33.44") << 0x6fde212cu << "111.222.33.44"; QTest::newRow("255.255.255.255") << 0xffffffffu << "255.255.255.255"; } |