Fix use of unitialized memory

This commit is contained in:
avogar 2022-05-17 12:59:46 +00:00
parent 415aabd4d0
commit 46f4f8a457
3 changed files with 13 additions and 2 deletions

View File

@ -87,7 +87,7 @@ namespace detail
if (null_map && (*null_map)[i])
{
vec_res[i] = 0;
std::fill_n(&vec_res[i], IPV6_BINARY_LENGTH, 0);
src_offset = src_next_offset;
if constexpr (exception_mode == IPStringToNumExceptionMode::Null)
(*vec_null_map_to)[i] = true;

View File

@ -17,8 +17,16 @@ true
\N
0.0.0.0
\N
0.0.0.0
\N
\N
\N
0
\N
::
\N
::
\N
\N
\N
\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0

View File

@ -14,7 +14,10 @@ select CAST(number % 2 ? '0000:0000:0000:0000:0000:0000:0000:0000' : NULL, 'Null
select toBool(number % 2 ? 'true' : NULL) from numbers(2);
select toIPv4(number % 2 ? '0.0.0.0' : NULL) from numbers(2);
select toIPv4OrDefault(number % 2 ? '' : NULL) from numbers(2);
select toIPv4OrNull(number % 2 ? '' : NULL) from numbers(2);
select IPv4StringToNum(number % 2 ? '0.0.0.0' : NULL) from numbers(2);
select toIPv6(number % 2 ? '0000:0000:0000:0000:0000:0000:0000:0000' : NULL) from numbers(2);
select toIPv6OrDefault(number % 2 ? '' : NULL) from numbers(2);
select toIPv6OrNull(number % 2 ? '' : NULL) from numbers(2);
select IPv6StringToNum(number % 2 ? '0000:0000:0000:0000:0000:0000:0000:0000' : NULL) from numbers(2);