Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 8 Oct 2008 23:53:08 -0700 (PDT)
From:      "Dorr H. Clark" <dclark@engr.scu.edu>
To:        bug-followup@FreeBSD.org
Cc:        freebsd-bugs@FreeBSD.org, martinko <gamato@users.sourceforge.net>
Subject:   Re: gnu/105221: grep(1): `grep -w -F ""` issue
Message-ID:  <Pine.GSO.4.21.0810082350230.15548-100000@nova41.dc.engr.scu.edu>

next in thread | raw e-mail | index | archive | help

  gnu/105221

The behavior described in 105221 is due to 'grep' looping 
infinitely within Fexecute() of revision 1.25 of search.c. 

When used with the combination of '-w' and '-F' and 
the empty string, 'grep' enters a inescapable "while(1)" block 

A proposed fix then, is to immediately fail the search for a match 
when grep is called with this combination of options if the
string to match is zero-length (and thus, trivially does not match
the non-empty input!).

David K Lam
Engineer

Dorr H. Clark
Advisor

Graduate School of Engineering
Santa Clara University
Santa Clara, CA

http://www.cse.scu.edu/~dclark/coen_284_FreeBSD/105221.txt

--- /usr/src/gnu/usr.bin/grep/search.c	2006-02-19 04:27:39.000000000 +0000
+++ search.c	2008-08-21 00:29:38.000000000 +0000
@@ -959,6 +959,10 @@
 	}
       else if (match_words)
 	{
+
+          if(beg[len-1] == eol)
+            break;
+
 	  while (1)
 	    {
 	      int word_match = 0;


 
 







Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.GSO.4.21.0810082350230.15548-100000>