This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: question about regex


On 1/2/20 8:16 AM, Tim Rühsen wrote:
Meanwhile grep (or libc) seems to exit gracefully:

Yes, there's no core dump if the operating system supports stack overflow detection that grep can use. The problem occurs only on OSes that don't do that, or on apps that don't try to detect stack overflow and simply dump core (or worse).

On 1/2/20 2:54 AM, liqingqing wrote:

do we have any plan or good ways to fix up the bug as below

The best way would be to fix bug#24269, i.e., fix the glibc regex code so that it doesn't blow the stack. If you could write a patch for this bug (something that doesn't hurt performance for ordinary regexps), that would be welcome.

For that particular test case, you can use an OS that does proper stack overflow checking that grep can use.

PS. The next version of the grep manual is planned to nearly wash its hands of the matter. Here's the current draft:

----

Back-references can greatly slow down matching, as they can generate
exponentially many matching possibilities that can consume both time
and memory to explore.  Also, the POSIX specification for
back-references is at times unclear.  Furthermore, many regular
expression implementations have back-reference bugs that can cause
programs to return incorrect answers or even crash, and fixing these
bugs has often been low-priority: for example, as of 2020 the
@url{https://sourceware.org/bugzilla/,GNU C library bug database}
contained back-reference bugs
@url{https://sourceware.org/bugzilla/show_bug.cgi?id=52,,52},
@url{https://sourceware.org/bugzilla/show_bug.cgi?id=10844,,10844},
@url{https://sourceware.org/bugzilla/show_bug.cgi?id=11053,,11053},
@url{https://sourceware.org/bugzilla/show_bug.cgi?id=24269,,24269}
and @url{https://sourceware.org/bugzilla/show_bug.cgi?id=25322,,25322},
with little sign of forthcoming fixes.  Luckily,
back-references are rarely useful and it should be little trouble to
avoid them in practical applications.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]