From: Rich Felker <dalias@libc.org>
To: "Quesada Gonzalez, Elena" <elena.quesada_gonzalez@siemens.com>
Cc: "musl@lists.openwall.com" <musl@lists.openwall.com>
Subject: Re: [musl] SIGSEV error when using REGEX with musl library
Date: Thu, 25 Nov 2021 10:52:00 -0500 [thread overview]
Message-ID: <20211125155200.GB7074@brightrain.aerifal.cx> (raw)
In-Reply-To: <DB8PR10MB32590DA901278443AFD3CD35B5629@DB8PR10MB3259.EURPRD10.PROD.OUTLOOK.COM>
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
next prev parent reply other threads:[~2021-11-25 15:52 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-25 14:53 Quesada Gonzalez, Elena
2021-11-25 15:52 ` Rich Felker [this message]
2021-11-26 11:46 ` Quesada Gonzalez, Elena
2021-11-26 16:32 ` Alex Xu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211125155200.GB7074@brightrain.aerifal.cx \
--to=dalias@libc.org \
--cc=elena.quesada_gonzalez@siemens.com \
--cc=musl@lists.openwall.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).