jeudi 25 novembre 2021

SIGSEGV error when using REGEX compiling with Clang and musl library

I have the following function that works fine if the regular expresion is correct, but get a SIGSEGV otherwise when compiling with clang-9 and using musl 1.2. However, it works fine with clang and glibc, tho, but I need to used musl instead.

Could someone help me here?

` 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));
    }

Aucun commentaire:

Enregistrer un commentaire