diff --git a/src/Functions/FunctionsCoding.h b/src/Functions/FunctionsCoding.h index 428f4891990..a311c6938d6 100644 --- a/src/Functions/FunctionsCoding.h +++ b/src/Functions/FunctionsCoding.h @@ -311,7 +311,7 @@ public: std::memcpy( src_ipv4_buf + std::strlen("::ffff:"), reinterpret_cast(&vec_src[src_offset]), - std::strlen(reinterpret_cast(&vec_src[src_offset]))); + std::min(offsets_src[i] - src_offset, IPV4_MAX_TEXT_LENGTH + 1)); parseIPv6(src_ipv4_buf, reinterpret_cast(&vec_res[out_offset])); } else diff --git a/tests/queries/0_stateless/00725_ipv4_ipv6_domains.reference b/tests/queries/0_stateless/00725_ipv4_ipv6_domains.reference index bddd10ba865..e0922ad435d 100644 --- a/tests/queries/0_stateless/00725_ipv4_ipv6_domains.reference +++ b/tests/queries/0_stateless/00725_ipv4_ipv6_domains.reference @@ -62,3 +62,6 @@ FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF is ipv6 string: 1 ::ffff:127.0.0.7 ::ffff:127.0.0.8 ::ffff:127.0.0.9 +::ffff:127.0.0.10 +::ffff:127.0.0.11 +::ffff:127.0.0.12 diff --git a/tests/queries/0_stateless/00725_ipv4_ipv6_domains.sql b/tests/queries/0_stateless/00725_ipv4_ipv6_domains.sql index 39f50781a7e..5815afb1605 100644 --- a/tests/queries/0_stateless/00725_ipv4_ipv6_domains.sql +++ b/tests/queries/0_stateless/00725_ipv4_ipv6_domains.sql @@ -89,4 +89,4 @@ SELECT '2001:0DB8:AC10:FE01:FEED:BABE:CAFE:F00D is ipv6 string: ', isIPv6String( SELECT toIPv6('0.0.0.0'); SELECT toIPv6('127.0.0.1'); SELECT cutIPv6(IPv6StringToNum('127.0.0.1'), 0, 0); -SELECT toIPv6('127.0.0.' || toString(number)) FROM numbers(10); +SELECT toIPv6('127.0.0.' || toString(number)) FROM numbers(13);