[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#19252: [PATCH] dfa: matching at next position or infinit loop in mat
From: |
Jim Meyering |
Subject: |
bug#19252: [PATCH] dfa: matching at next position or infinit loop in matching mode |
Date: |
Sat, 6 Dec 2014 22:31:01 -0800 |
On Wed, Dec 3, 2014 at 2:18 AM, Norihiro Tanaka <address@hidden> wrote:
> On Tue, 2 Dec 2014 08:35:32 -0800
> Jim Meyering <address@hidden> wrote:
>> I'm not sure I understand the above paragraph.
>> Is this what you intended?
>>
>> That will cause an invalid match or an infinite loop.
>> By the way, there is no option to make grep use
>> searching mode rather than matching mode.
>
> That will cause an invalid match or an infinite loop.
> By the way, there is no option to make grep use
> matching mode rather than searching mode.
>
>> Can you provide a test case to trigger this?
>> Is it easier to construct a test case using gawk?
>
> Yes, but it uses neither grep nor gawk. It uses an auxiliary program
> writtern only to accomplish the test, as grep and gawk do *NOT* set 0 to
> forth argument of dfacomp. I added tests of failure and infloop version.
Thank you for adding that test program and a script to run it.
I have made some changes:
- reworded the commit logs
- removed the NEWS entry, since this is not a user-visible change
- changed a 4-line sequence in dfa.c to a single one using the
ternary operator:
- if (allow_nl)
- s = d->newlines[s1];
- else
- s = 0;
+ s = allow_nl ? d->newlines[s1] : 0;
- fixed the new "make syntax-check" violations induced
by the addition of that new .c file.
- changed the test script to use warn_ rather than printf
- replaced the full hex SHA1 in the log with the more useful
and readable "git desc ..." output: v2.5.4-144-gbafa134
See attached:
0001-dfa-avoid-invalid-match-or-infinite-loop-in-unused-m.patch
Description: Binary data
0002-dfa-simplify-dfaexec.patch
Description: Binary data