public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "timshen at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/63497] std::regex can't handle [^class] correctly and cause runtime crash Date: Fri, 10 Oct 2014 11:03:00 -0000 [thread overview] Message-ID: <bug-63497-4-G9W00Otilo@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-63497-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63497 --- Comment #2 from Tim Shen <timshen at gcc dot gnu.org> --- Thanks for reporting :) This bug is still in trunk, it just somehow can't trigger the segfault or wrong output. The line trunk/bits/regex_executor.tcc:297 : if (__state._M_matches(*_M_current)) doesn't check if _M_current != _M_end. One way is to create a helper function that may fail to (return a false as a successfulness of dereference) dereference, but it's less efficient, unless the compiler can do reasoning + unnecessary predication elimination. I'm not sure about that. If you are interested, take a look at _Executor::_M_word_boundary and try to explode the first *_M_current (line 419 in trunk). My answer is: regex_match("", regex("\\b"), regex_constants::match_not_eol); For that case, can the compiler inline and eliminate unnecessary _M_current == _M_end, if we blindly check it (through some helper function) everywhere? Or, as I prefer, I can do a file scope wise check for each direct or indirect _M_current dereference.
next prev parent reply other threads:[~2014-10-10 11:03 UTC|newest] Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top 2014-10-09 12:00 [Bug c++/63497] New: " moophy at foxmail dot com 2014-10-09 12:39 ` [Bug c++/63497] " redi at gcc dot gnu.org 2014-10-10 11:03 ` timshen at gcc dot gnu.org [this message] 2014-10-10 20:30 ` moophy at foxmail dot com 2014-10-10 21:07 ` timshen at gcc dot gnu.org 2014-10-23 3:34 ` timshen at gcc dot gnu.org 2014-11-23 14:30 ` [Bug libstdc++/63497] " paolo.carlini at oracle dot com 2014-11-23 18:51 ` redi at gcc dot gnu.org 2014-11-28 6:51 ` timshen at gcc dot gnu.org 2014-11-28 20:24 ` timshen at gcc dot gnu.org 2023-07-20 11:31 ` redi at gcc dot gnu.org
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=bug-63497-4-G9W00Otilo@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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 read-only IMAP folder(s) and NNTP newsgroup(s).