Signed-off-by: Alex Henrie <alexhenrie24(a)gmail.com>
---
These edge cases were identified by a program I wrote that feeds 10
million randomly generated IPv6-like strings to RtlIpv6StringToAddress
and compares the output from my implementation to the output on Windows.
I have now updated my implementation to pass all of the new tests and I
intend to clean it up and send it to Wine Staging this weekend.
---
dlls/ntdll/tests/rtl.c | 48 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 48 insertions(+)
diff --git a/dlls/ntdll/tests/rtl.c b/dlls/ntdll/tests/rtl.c
index c7470258fb..7b41c8b90e 100644
--- a/dlls/ntdll/tests/rtl.c
+++ b/dlls/ntdll/tests/rtl.c
@@ -1539,6 +1539,8 @@ static const struct
{ 0x1111, 0x2222, 0x3333, 0x4444, 0x5555, 0x6666, 0, 0x8888 } },
{ "1111:2222:3333:4444:5555:6666::7777:8888", STATUS_SUCCESS, 35,
{ 0x1111, 0x2222, 0x3333, 0x4444, 0x5555, 0x6666, 0, 0x7777 }, ex_fail_6 },
+ { "1111:2222:3333:4444:5555:6666:7777::8888", STATUS_SUCCESS, 36,
+ { 0x1111, 0x2222, 0x3333, 0x4444, 0x5555, 0x6666, 0x7777, 0 }, win_broken_6 },
{ "1111:2222:3333:4444:5555::", STATUS_SUCCESS, 26,
{ 0x1111, 0x2222, 0x3333, 0x4444, 0x5555, 0, 0, 0 } },
{ "1111:2222:3333:4444:5555::123.123.123.123", STATUS_SUCCESS, 41,
@@ -1555,8 +1557,20 @@ static const struct
{ 0x1111, 0x2222, 0x3333, 0x4444, 0x5555, 0, 0, 0x8800 }, ex_fail_6 },
{ "1111:2222:3333:4444:5555::0x8888", STATUS_SUCCESS, 27,
{ 0x1111, 0x2222, 0x3333, 0x4444, 0x5555, 0, 0, 0x8888 }, ex_fail_6 },
+ { "1111:2222:3333:4444::5555:0x123456789", STATUS_SUCCESS, 27,
+ { 0x1111, 0x2222, 0x3333, 0x4444, 0, 0, 0x5555, 0xffff }, ex_fail_6 },
+ { "1111:2222:3333:4444:5555:6666:0x012345678", STATUS_INVALID_PARAMETER, 31,
+ { 0x1111, 0x2222, 0x3333, 0x4444, 0x5555, 0x6666, 0xabab, 0xabab }, ex_fail_6 },
+ { "1111:2222:3333:4444:5555:6666:0x123456789", STATUS_INVALID_PARAMETER, 31,
+ { 0x1111, 0x2222, 0x3333, 0x4444, 0x5555, 0x6666, 0xabab, 0xabab }, ex_fail_6 },
{ "1111:2222:3333:4444:5555::08888", STATUS_INVALID_PARAMETER, 31,
{ 0x1111, 0x2222, 0x3333, 0x4444, 0x5555, 0xabab, 0xabab, 0xabab } },
+ { "1111:2222:3333:4444:5555::08888::", STATUS_INVALID_PARAMETER, 31,
+ { 0x1111, 0x2222, 0x3333, 0x4444, 0x5555, 0xabab, 0xabab, 0xabab } },
+ { "1111:2222:3333:4444:5555:6666:7777:fffff:", STATUS_INVALID_PARAMETER, 40,
+ { 0x1111, 0x2222, 0x3333, 0x4444, 0x5555, 0x6666, 0x7777, 0xabab } },
+ { "1111:2222:3333:4444:5555:6666::fffff:", STATUS_INVALID_PARAMETER, 36,
+ { 0x1111, 0x2222, 0x3333, 0x4444, 0x5555, 0x6666, 0xabab, 0xabab } },
{ "1111:2222:3333:4444:5555::fffff", STATUS_INVALID_PARAMETER, 31,
{ 0x1111, 0x2222, 0x3333, 0x4444, 0x5555, 0xabab, 0xabab, 0xabab } },
{ "1111:2222:3333:4444::fffff", STATUS_INVALID_PARAMETER, 26,
@@ -1672,16 +1686,24 @@ static const struct
{ -1 } },
{ "1111", STATUS_INVALID_PARAMETER, 4,
{ -1 } },
+ { "0x1111", STATUS_INVALID_PARAMETER, 1,
+ { -1 } },
{ "1111:22223333:4444:5555:6666:1.2.3.4", STATUS_INVALID_PARAMETER, -1,
{ 0x1111, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab } },
{ "1111:22223333:4444:5555:6666:7777:8888", STATUS_INVALID_PARAMETER, -1,
{ 0x1111, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab } },
+ { "1111:123456789:4444:5555:6666:7777:8888", STATUS_INVALID_PARAMETER, -1,
+ { 0x1111, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab } },
+ { "1111:1234567890abcdef0:4444:5555:6666:7777:888", STATUS_INVALID_PARAMETER, -1,
+ { 0x1111, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab } },
{ "1111:2222:", STATUS_INVALID_PARAMETER, 10,
{ 0x1111, 0x2222, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab } },
{ "1111:2222:1.2.3.4", STATUS_INVALID_PARAMETER, 17,
{ 0x1111, 0x2222, 0x201, 0xab03, 0xabab, 0xabab, 0xabab, 0xabab } },
{ "1111:2222:3333", STATUS_INVALID_PARAMETER, 14,
{ 0x1111, 0x2222, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab } },
+ { "1111:2222:3333:4444:5555:6666::1.2.3.4", STATUS_SUCCESS, 32,
+ { 0x1111, 0x2222, 0x3333, 0x4444, 0x5555, 0x6666, 0, 0x100 }, ex_fail_6 },
{ "1111:2222:3333:4444:5555:6666:7777:1.2.3.4", STATUS_SUCCESS, 36,
{ 0x1111, 0x2222, 0x3333, 0x4444, 0x5555, 0x6666, 0x7777, 0x100 }, ex_fail_6 },
{ "1111:2222:3333:4444:5555:6666:7777:8888:", STATUS_SUCCESS, 39,
@@ -1702,10 +1724,26 @@ static const struct
{ 0x1111, 0, 0, 0, 0, 0, 0, 0x3333 }, ex_fail_6 },
{ "12345::6:7:8", STATUS_INVALID_PARAMETER, -1,
{ -1 } },
+ { "1::001.2.3.4", STATUS_SUCCESS, 12,
+ { 0x100, 0, 0, 0, 0, 0, 0x201, 0x403 } },
+ { "1::1.002.3.4", STATUS_SUCCESS, 12,
+ { 0x100, 0, 0, 0, 0, 0, 0x201, 0x403 } },
+ { "1::0001.2.3.4", STATUS_INVALID_PARAMETER, -1,
+ { 0x100, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab } },
+ { "1::1.0002.3.4", STATUS_INVALID_PARAMETER, -1,
+ { 0x100, 0xab01, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab } },
{ "1::1.2.256.4", STATUS_INVALID_PARAMETER, -1,
{ 0x100, 0x201, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab } },
+ { "1::1.2.4294967296.4", STATUS_INVALID_PARAMETER, -1,
+ { 0x100, 0x201, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab } },
+ { "1::1.2.18446744073709551616.4", STATUS_INVALID_PARAMETER, -1,
+ { 0x100, 0x201, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab } },
{ "1::1.2.3.256", STATUS_INVALID_PARAMETER, 12,
{ 0x100, 0x201, 0xab03, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab } },
+ { "1::1.2.3.4294967296", STATUS_INVALID_PARAMETER, 19,
+ { 0x100, 0x201, 0xab03, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab } },
+ { "1::1.2.3.18446744073709551616", STATUS_INVALID_PARAMETER, 29,
+ { 0x100, 0x201, 0xab03, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab } },
{ "1::1.2.3.300", STATUS_INVALID_PARAMETER, 12,
{ 0x100, 0x201, 0xab03, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab } },
{ "1::1.2::1", STATUS_INVALID_PARAMETER, 6,
@@ -1758,6 +1796,16 @@ static const struct
{ -1 } },
{ "::-1", STATUS_SUCCESS, 2,
{ 0, 0, 0, 0, 0, 0, 0, 0 }, ex_fail_6 },
+ { "::123456789", STATUS_INVALID_PARAMETER, 11,
+ { 0, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab } },
+ { "::1234567890abcdef0", STATUS_INVALID_PARAMETER, 19,
+ { 0, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab } },
+ { "::0x012345678", STATUS_SUCCESS, 3,
+ { 0, 0, 0, 0, 0, 0, 0, 0x7856 }, ex_fail_6 },
+ { "::0x123456789", STATUS_SUCCESS, 3,
+ { 0, 0, 0, 0, 0, 0, 0, 0xffff }, ex_fail_6 },
+ { "::0x1234567890abcdef0", STATUS_SUCCESS, 3,
+ { 0, 0, 0, 0, 0, 0, 0, 0xffff }, ex_fail_6 },
{ "::.", STATUS_SUCCESS, 2,
{ 0, 0, 0, 0, 0, 0, 0, 0 }, ex_fail_6 },
{ "::..", STATUS_SUCCESS, 2,
--
2.25.1