From 5aa203625d1c32b10401460cacd1dd68b850b1d0 Mon Sep 17 00:00:00 2001 From: Ganesh Maharaj Mahalingam Date: Mon, 11 Apr 2022 10:15:43 -0700 Subject: [PATCH] libcephsqlite: ceph-mgr crashes when compiled with gcc12 regex in libcephsqlite, when compiled with GCC12 treats '-' as a range operator resulting in the following error. "Invalid start of '[x-x]' range in regular expression" Fixes: https://tracker.ceph.com/issues/55304 Signed-off-by: Ganesh Maharaj Mahalingam (cherry picked from commit ac043a09c5ffb4b434b8644920004b3d5b7f9d8c) --- src/libcephsqlite.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libcephsqlite.cc b/src/libcephsqlite.cc index 3db64a19f65..a6e8a48833a 100644 --- a/src/libcephsqlite.cc +++ b/src/libcephsqlite.cc @@ -380,8 +380,8 @@ static int FileSize(sqlite3_file *file, sqlite_int64 *osize) static bool parsepath(std::string_view path, struct cephsqlite_fileloc* fileloc) { - static const std::regex re1{"^/*(\\*[[:digit:]]+):([[:alnum:]-_.]*)/([[:alnum:]-._]+)$"}; - static const std::regex re2{"^/*([[:alnum:]-_.]+):([[:alnum:]-_.]*)/([[:alnum:]-._]+)$"}; + static const std::regex re1{"^/*(\\*[[:digit:]]+):([[:alnum:]\\-_.]*)/([[:alnum:]\\-._]+)$"}; + static const std::regex re2{"^/*([[:alnum:]\\-_.]+):([[:alnum:]\\-_.]*)/([[:alnum:]\\-._]+)$"}; std::cmatch cm; if (!std::regex_match(path.data(), cm, re1)) { -- 2.47.3