|
Message-ID: <DB8PR10MB32595A48B26D8BA81C21FC8FB5639@DB8PR10MB3259.EURPRD10.PROD.OUTLOOK.COM> Date: Fri, 26 Nov 2021 11:46:25 +0000 From: "Quesada Gonzalez, Elena" <elena.quesada_gonzalez@...mens.com> To: Rich Felker <dalias@...c.org> CC: "musl@...ts.openwall.com" <musl@...ts.openwall.com> Subject: RE: SIGSEV error when using REGEX with musl library Hi, A simple main with the following code, should replicate the error. #include <regex> void main() { std::regex regexp("^[a-z0-9]{1,8}$"); std::string s = ("0xAz10145274"); if (false == std::regex_search(s, regexp)) { // Only fatal. Statement is not initialized yet. printf("Invalid regex [%s]\n", __FUNCTION__); exit(1); } else { printf("Regex ok [%s]\n", __FUNCTION__); } } Thanks for your time -----Mensaje original----- De: Rich Felker <dalias@...c.org> Enviado el: jueves, 25 de noviembre de 2021 16:52 Para: Quesada Gonzalez, Elena (SMO RI R&D ES PF 1) <elena.quesada_gonzalez@...mens.com> CC: musl@...ts.openwall.com Asunto: Re: [musl] SIGSEV error when using REGEX with musl library On Thu, Nov 25, 2021 at 02:53:13PM +0000, Quesada Gonzalez, Elena wrote: > I have the following function that works fine if the regular expression is correct, but get a SIGSEGV when calling regex_search compiling with clang-9 and using musl 1.2. > However, it works fine with glibc, > > Could be a bug in musl library? > > > Find code below > > void CRuntimeCommandLine::LoadComplement(const multimap<std::string, > std::string>& mapArguments) { > // Find parameter > multimap<string, string>::const_iterator iter; > iter = mapArguments.find("Complement"); > if(iter == mapArguments.end()) > { > // Only fatal. Statement is not initialized yet. > Logger::fatal(Errors::RCMD_F005_MISSING_MANDATORY_PARAM, "Missing mandatory parameter --Complement"); > } > // regex expression for system_secret to be checked (Max 4Bytes, hexadecimal number in lowe case letters and no 0x format) > regex regexp("^[0-9a-f]{1,8}$"); > > // regex_search that searches pattern regexp in the string mystr > std::string s = iter->second.c_str(); > if (false == std::regex_search(s, regexp)) > { > // Only fatal. Statement is not initialized yet. > Logger::fatal(Errors::RCMD_F006_INVALID_VALUE, "Invalid --Complement=hexvalue value"); > } > else > { > // get hexadecimal value > (void)sscanf(s.c_str(), "%X", &(m_cmdParameters.complementValue)); > } > > } > With kind regards > Elena Quesada Gonzalez Do you have a complete minimal-ish test case that can be compiled and show the same thing happening? Even just a dummy main() to call the above the way you expect it to be called? Rich
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.