Paul Eggert wrote:
> On 03/16/2012 05:14 AM, Jim Meyering wrote:
>> A patch would be most welcome.
>
> OK, here's a proposed patch.  It assumes syncing from gnulib
> (to pick up the gnulib regex fix).
>
>>From 0dd8ab2b726e6f7486db25cf10ac24f4b961faa0 Mon Sep 17 00:00:00 2001
> From: Paul Eggert <[email protected]>
> Date: Sat, 17 Mar 2012 18:04:50 -0700
> Subject: [PATCH] grep: report overflow for ERE a{1000000000}
>
> * NEWS: Document this.
> * src/dfa.c (MIN): New macro.
> (lex): Lexically analyze the repeat-count operator once, not
> twice; the double-scan complicated the code and made it harder to
> understand and fix.  Adjust the repeat-count parsing so that it
> better matches the behavior of the regex code, in three ways:
> 1. Diagnose too-large repeat counts rather than treating them as
> literal characters.  2. Use RE_INVALID_INTERVAL_ORD, not
> RE_NO_BK_BRACES, to decide whether to treat invalid-syntax {...}s
> as literals.  3. Use the same wording for {...}-related
> diagnostics that the regex code uses.
> * tests/bre.tests, tests/ere.tests, tests/repetition-overflow:
> Adjust to match new behavior, and add a few tests.
...

Thanks a lot.  Fewer bugs and fewer lines.  Very nice!

It needn't delay your pushing this, but it would be good to add a test
that requires each of the two new DFA-emitted diagnostics.

Reply via email to