Skip to content

Commit

Permalink
feat utils: disallow falling back to Boost.Regex by default
Browse files Browse the repository at this point in the history
commit_hash:41d5cfa759e263c424316c91e74369cb9e25981a
  • Loading branch information
Anton3 committed Jan 23, 2025
1 parent 3b561d9 commit 34dfaa8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion core/src/components/manager_config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ struct ManagerConfig {
bool mlock_debug_info{true};
bool disable_phdr_cache{false};
bool preheat_stacktrace_collector{true};
bool implicit_boost_regex_fallback_allowed{true};
bool implicit_boost_regex_fallback_allowed{false};

static ManagerConfig FromString(
const std::string&,
Expand Down
6 changes: 2 additions & 4 deletions universal/src/utils/regex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class RegexErrorImpl : public RegexError {
namespace {

constexpr std::size_t kGroupsSboSize = 5;
USERVER_IMPL_CONSTINIT std::atomic<bool> implicit_boost_regex_fallback_allowed{true};
USERVER_IMPL_CONSTINIT std::atomic<bool> implicit_boost_regex_fallback_allowed{false};

re2::RE2::Options MakeRE2Options() {
re2::RE2::Options options{};
Expand Down Expand Up @@ -402,9 +402,7 @@ std::string regex_replace(std::string_view str, const regex& pattern, std::strin

bool IsImplicitBoostRegexFallbackAllowed() noexcept { return true; }

void SetImplicitBoostRegexFallbackAllowed(bool allowed) noexcept {
UINVARIANT(allowed, "Cannot stop using boost::regex, because re2 is disabled");
}
void SetImplicitBoostRegexFallbackAllowed(bool /*allowed*/) noexcept {}

#endif

Expand Down

0 comments on commit 34dfaa8

Please sign in to comment.