regex: fix invalid start of '[x-x]' range 46/310846/1 accepted/tizen_9.0_unified accepted/tizen_unified accepted/tizen_unified_dev accepted/tizen_unified_toolchain accepted/tizen_unified_x accepted/tizen_unified_x_asan tizen tizen_9.0 accepted/tizen/9.0/unified/20241030.233709 accepted/tizen/unified/20240603.032400 accepted/tizen/unified/dev/20240620.003733 accepted/tizen/unified/toolchain/20240624.121759 accepted/tizen/unified/x/20240604.013111 accepted/tizen/unified/x/asan/20240625.093103 tizen_9.0_m2_release
authorDongkyun Son <dongkyun.s@samsung.com>
Thu, 9 May 2024 02:53:36 +0000 (11:53 +0900)
committerDongkyun Son <dongkyun.s@samsung.com>
Thu, 9 May 2024 02:58:19 +0000 (11:58 +0900)
Fix terminate called after throwing an instance of 'std::regex_error'
  what():  Invalid start of '[x-x]' range in regular expression

Change-Id: I97a7f57da8869d47400bfca26bfc5ff839fc0fa4

src/trigger/CustomTemplate.cpp

index 06136c08bda8c935d501f89fe7e83fa6c42d5e9c..7e746d49e09bc5b7bf0045d5eb5635ac3ee9f119 100644 (file)
@@ -246,7 +246,7 @@ bool CustomTemplate::checkTemplateEnum(const Json::Value& elem)
 
 int CustomTemplate::add(const std::string& name, const std::string& attrTmpl)
 {
-       static std::regex nameRegex(R"~(^[\w-\._\/]+$)~", std::regex::optimize);
+       static std::regex nameRegex(R"~(^[\w\-\._\/]+$)~", std::regex::optimize);
        IF_FAIL_RETURN_TAG(std::regex_match(name, nameRegex), CONTEXT_TRIGGER_ERROR_INVALID_PARAMETER, _E, "Invalid name");
 
        Json::Value tmplJson;