public inbox for glibc-bugs-regex@sourceware.org
help / color / mirror / Atom feed
From: "linjy0410 at gmail dot com" <sourceware-bugzilla@sourceware.org>
To: glibc-bugs-regex@sourceware.org
Subject: [Bug regex/29642] New: `regcomp` with multiple adjacent plus sign would exhaust memory quickly
Date: Sun, 02 Oct 2022 07:10:41 +0000	[thread overview]
Message-ID: <bug-29642-132@http.sourceware.org/bugzilla/> (raw)

https://sourceware.org/bugzilla/show_bug.cgi?id=29642

            Bug ID: 29642
           Summary: `regcomp` with multiple adjacent plus sign would
                    exhaust memory quickly
           Product: glibc
           Version: unspecified
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: regex
          Assignee: unassigned at sourceware dot org
          Reporter: linjy0410 at gmail dot com
                CC: drepper.fsp at gmail dot com
  Target Milestone: ---

Hi! We found that in the latest pull, when `regcomp` with `REG_EXTENDED` is
compiling pattern with multiple adjacent '+', like
"1*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++",
the memory would be exhausted very quickly.
Because in `duplicate_tree` it exponentially calls `create_token_tree` which
malloc all the memory, looks like it's easy to cause serious DOS.
Checked the regex specification that said "multiple adjacent duplication
symbols ( '+', '*', '?', and intervals) produces undefined results.", and seems
like other regex implementation have handled this, maybe glibc needs to handle
it too?

-- 
You are receiving this mail because:
You are on the CC list for the bug.

             reply	other threads:[~2022-10-02  7:10 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-02  7:10 linjy0410 at gmail dot com [this message]
2022-10-02  7:12 ` [Bug regex/29642] " linjy0410 at gmail dot com
2023-08-24 15:01 ` jwakely.gcc at gmail dot com
2023-08-24 15:05 ` jwakely.gcc at gmail dot com

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-29642-132@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=glibc-bugs-regex@sourceware.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: link
Be 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).