]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
libcephsqlite: ceph-mgr crashes when compiled with gcc12 47271/head
authorGanesh Maharaj Mahalingam <ganesh.mahalingam@intel.com>
Mon, 11 Apr 2022 17:15:43 +0000 (10:15 -0700)
committerVikhyat Umrao <vikhyat@redhat.com>
Mon, 25 Jul 2022 22:59:49 +0000 (15:59 -0700)
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 <ganesh.mahalingam@intel.com>
(cherry picked from commit ac043a09c5ffb4b434b8644920004b3d5b7f9d8c)

src/libcephsqlite.cc

index 3db64a19f65241074d79c6ce167aa05307f69c2b..a6e8a48833a8dcef7636069c902a48f2d8f10ad8 100644 (file)
@@ -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)) {