[Bug regex/18041] New: infinite loop in regcomp/calc_eclosure_iter

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[Bug regex/18041] New: infinite loop in regcomp/calc_eclosure_iter

macro@linux-mips.org
https://sourceware.org/bugzilla/show_bug.cgi?id=18041

            Bug ID: 18041
           Summary: infinite loop in regcomp/calc_eclosure_iter
           Product: glibc
           Version: 2.21
            Status: NEW
          Severity: normal
          Priority: P2
         Component: regex
          Assignee: unassigned at sourceware dot org
          Reporter: konstantin.s.serebryany at gmail dot com
                CC: drepper.fsp at gmail dot com

#include <regex.h>
int main() {
  regex_t r;
  const char p[] = {135, 57, 42, 92, 39, 82, 42, 42, 123, 57, 48, 125, 0};
  regcomp(&r, p, 75);
  return 0;
}

gcc re3.cc && ./a.out  # never ends

...
#253 0x00007ffff7af3c1f in calc_eclosure_iter
(new_set=new_set@entry=0x7fffffffdb80, dfa=dfa@entry=0x602120,
node=node@entry=2, root=root@entry=1) at regcomp.c:1732
#254 0x00007ffff7af7847 in calc_eclosure (dfa=<optimized out>) at
regcomp.c:1672
#255 analyze (preg=<optimized out>) at regcomp.c:1198
#256 re_compile_internal (preg=preg@entry=0x7fffffffdc80,
pattern=pattern@entry=0x7fffffffdcc0 "\207\071*\\'R**{90}", length=<optimized
out>, syntax=syntax@entry=4436732) at regcomp.c:804
#257 0x00007ffff7af8a80 in __regcomp (preg=0x7fffffffdc80,
pattern=0x7fffffffdcc0 "\207\071*\\'R**{90}", cflags=<optimized out>) at
regcomp.c:506
#258 0x0000000000400601 in main ()

2.19 and fresh trunk are affected.
Found with the same fuzzer as bugs 18032, 18036, 18037, 18040

--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug regex/18041] infinite loop in regcomp/calc_eclosure_iter

macro@linux-mips.org
https://sourceware.org/bugzilla/show_bug.cgi?id=18041

Florian Weimer <fweimer at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
              Flags|                            |security-

--- Comment #1 from Florian Weimer <fweimer at redhat dot com> ---
I'm flagging this as security- based on our policy for regcomp bugs:

  https://sourceware.org/glibc/wiki/Security%20Exceptions

--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug regex/18041] infinite loop in regcomp/calc_eclosure_iter

macro@linux-mips.org
In reply to this post by macro@linux-mips.org
https://sourceware.org/bugzilla/show_bug.cgi?id=18041

Florian Weimer <fweimer at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |fweimer at redhat dot com

--
You are receiving this mail because:
You are on the CC list for the bug.
Reply | Threaded
Open this post in threaded view
|

[Bug regex/18041] infinite loop in regcomp/calc_eclosure_iter

macro@linux-mips.org
In reply to this post by macro@linux-mips.org
https://sourceware.org/bugzilla/show_bug.cgi?id=18041

--- Comment #2 from Kostya Serebryany <konstantin.s.serebryany at gmail dot com> ---
Similar case. It also eats all the available RAM.

#include <regex.h>
int main() {
  regex_t r;
  regcomp(&r, "\\(^\\)\\{9999\\}", 0);
  return 0;
}

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