Merge pull request #11949 from ClickHouse/fix-race-condition-extract-all-groups

Fix race condition in extractAllGroups
This commit is contained in:
alexey-milovidov 2020-06-26 00:52:29 +03:00 committed by GitHub
commit b041479d90
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 4 deletions

View File

@ -126,7 +126,7 @@ struct MatchImpl
{ {
size_t size = offsets.size(); size_t size = offsets.size();
const auto & regexp = Regexps::get<like, true>(pattern); auto regexp = Regexps::get<like, true>(pattern);
std::string required_substring; std::string required_substring;
bool is_trivial; bool is_trivial;
@ -281,7 +281,7 @@ struct MatchImpl
{ {
size_t size = data.size() / n; size_t size = data.size() / n;
const auto & regexp = Regexps::get<like, true>(pattern); auto regexp = Regexps::get<like, true>(pattern);
std::string required_substring; std::string required_substring;
bool is_trivial; bool is_trivial;

View File

@ -82,7 +82,8 @@ public:
throw Exception("Length of 'needle' argument must be greater than 0.", ErrorCodes::BAD_ARGUMENTS); throw Exception("Length of 'needle' argument must be greater than 0.", ErrorCodes::BAD_ARGUMENTS);
using StringPiece = typename Regexps::Regexp::StringPieceType; using StringPiece = typename Regexps::Regexp::StringPieceType;
const auto & regexp = Regexps::get<false, false>(needle)->getRE2(); auto holder = Regexps::get<false, false>(needle);
const auto & regexp = holder->getRE2();
if (!regexp) if (!regexp)
throw Exception("There are no groups in regexp: " + needle, ErrorCodes::BAD_ARGUMENTS); throw Exception("There are no groups in regexp: " + needle, ErrorCodes::BAD_ARGUMENTS);

View File

@ -61,7 +61,7 @@ public:
if (needle.empty()) if (needle.empty())
throw Exception(getName() + " length of 'needle' argument must be greater than 0.", ErrorCodes::BAD_ARGUMENTS); throw Exception(getName() + " length of 'needle' argument must be greater than 0.", ErrorCodes::BAD_ARGUMENTS);
const auto regexp = Regexps::get<false, false>(needle); auto regexp = Regexps::get<false, false>(needle);
const auto & re2 = regexp->getRE2(); const auto & re2 = regexp->getRE2();
if (!re2) if (!re2)