Addition to prev. revision [#CLICKHOUSE-2]

This commit is contained in:
Alexey Milovidov 2018-09-02 06:52:04 +03:00
parent ff13752d01
commit b9c4820bdd
3 changed files with 11 additions and 6 deletions

View File

@ -191,7 +191,8 @@ struct PositionImpl
++i;
}
memset(&res[i], 0, (res.size() - i) * sizeof(res[0]));
if (i < res.size())
memset(&res[i], 0, (res.size() - i) * sizeof(res[0]));
}
/// Search for substring in string.
@ -389,7 +390,8 @@ struct MatchImpl
}
/// Tail, in which there can be no substring.
memset(&res[i], revert, (res.size() - i) * sizeof(res[0]));
if (i < res.size())
memset(&res[i], revert, (res.size() - i) * sizeof(res[0]));
}
else
{
@ -407,7 +409,8 @@ struct MatchImpl
{
if (!regexp->getRE2()) /// An empty regexp. Always matches.
{
memset(res.data(), 1, size * sizeof(res[0]));
if (size)
memset(res.data(), 1, size * sizeof(res[0]));
}
else
{
@ -488,7 +491,8 @@ struct MatchImpl
++i;
}
memset(&res[i], revert, (res.size() - i) * sizeof(res[0]));
if (i < res.size())
memset(&res[i], revert, (res.size() - i) * sizeof(res[0]));
}
}
}

View File

@ -194,7 +194,8 @@ struct ExtractParamImpl
++i;
}
memset(&res[i], 0, (res.size() - i) * sizeof(res[0]));
if (res.size() > i)
memset(&res[i], 0, (res.size() - i) * sizeof(res[0]));
}
static void constant_constant(const std::string & data, std::string needle, ResultType & res)

View File

@ -105,7 +105,7 @@ inline ALWAYS_INLINE void writeSlice(const Slice & slice, NullableArraySink<Arra
if (slice.size == 1) /// Always true for ValueSlice.
sink.null_map[sink.current_offset] = 0;
else
else if (slice.size)
memset(&sink.null_map[sink.current_offset], 0, slice.size * sizeof(UInt8));
writeSlice(slice, static_cast<ArraySink &>(sink));