Fix race condition in extractAllGroups

This commit is contained in:
Alexey Milovidov 2020-06-25 19:57:30 +03:00
parent a34032cace
commit 9dc43fc435
3 changed files with 5 additions and 4 deletions

View File

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

View File

@ -82,7 +82,8 @@ public:
throw Exception("Length of 'needle' argument must be greater than 0.", ErrorCodes::BAD_ARGUMENTS);
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)
throw Exception("There are no groups in regexp: " + needle, ErrorCodes::BAD_ARGUMENTS);

View File

@ -61,7 +61,7 @@ public:
if (needle.empty())
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();
if (!re2)