🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Robert Brewer Mon, 07 Sep 1992 17:21
Bus Error in GNU egrep 1.6
#758
Author: Robert Brewer
Date: Mon, 07 Sep 1992 17:21
74 lines
3629 bytes
I have been trying to use GNU e?grep 1.6 in a project I have been working on.
However I have found the following series of patterns that causes GNU egrep to
crash. Interestingly enough, the crash appears to be in the actual parsing of
the regexp, because all the crashes can be replicated using stdin as input. 
There appears to be a set of regexps that cause the crash, but I am not sure
what the pattern is. Here is a sampling of the problem (fiji is a NeXTstation
running NeXTStep 2.0):

fiji [53] grep> set key=WoofUser
fiji [54] grep> eggrep -i "(^#Title:.*\<$key)|(^#Keywords:.*\<$key)|(^#Summary:.
*\<$key)"
Bus error
fiji [55] grep> set key=FoowUser
fiji [56] grep> eggrep -i "(^#Title:.*\<$key)|(^#Keywords:.*\<$key)|(^#Summary:.
*\<$key)"
Segmentation fault
fiji [57] grep> set key=FowoUser
fiji [58] grep> eggrep -i "(^#Title:.*\<$key)|(^#Keywords:.*\<$key)|(^#Summary:.
*\<$key)"
Segmentation fault
fiji [59] grep> set key=AabbUser
fiji [60] grep> eggrep -i "(^#Title:.*\<$key)|(^#Keywords:.*\<$key)|(^#Summary:.
*\<$key)"
^Cfiji [61] grep>
 
Note that the strings "WoofUser", "FoowUser", and "FowoUser" all cause crashes.
However "AabbUser" does not. I have been unable to find a pattern to the
strings that crash, but the list above is far from complete.

I made a brief attempt to find out what was going on with gdb:

fiji [22] grep-1.6> gdb egrep
GDB -- NeXT Release 2.0 (v19) -- GNU version 3.1
Copyright (C) 1988 Free Software Foundation, Inc.
There is ABSOLUTELY NO WARRANTY for GDB; type "info warranty" for details.
GDB is free software and you are welcome to distribute copies of it
under certain conditions; type "info copying" to see the conditions.
Reading symbol data from egrep...
Reading symbol data from /usr/shlib/libsys_s.B.shlib...
Reading Objective-C data...
done.
Type "help" for a list of commands.
(gdb) run -i "(^#Title:.*\<WoofUser)|(^#Keywords:.*\<WoofUser)|(^#Summary:.*\<Wo
ofUser)"
Starting program: /users/support/EArchive/paul/grep/grep-1.6/egrep -i "(^#Title:
.*\<WoofUser)|(^#Keywords:.*\<WoofUser)|(^#Summary:.*\<WoofUser)"
 
Program generated(1): Memory access exception on address 0x28 (protection failur
e).
0x5007108 in strlen ()
(gdb) backtrace
#0  0x5007108 in strlen ()
#1  0x690e in istrstr (lookin=(char *) 0x27c6c "woofuser", lookfor=(char *) 0x28
 <Address 0x28 out of bounds>) (dfa.c line 1871)
#2  0x6a1c in enlist (cpp=(char **) 0x27c08, new=(char *) 0x27bd4 "woofuser", le
n=8) (dfa.c line 1928)
#3  0x6b8c in addlists (old=(char **) 0x27c08, new=(char **) 0x27c60) (dfa.c lin
e 1997)
#4  0x6c42 in inboth (left=(char **) 0x261e8, right=(char **) 0x26024) (dfa.c li
ne 2031)
#5  0x6fca in regmust (reg=(struct regexp *) 0xc60e) (dfa.c line 2153)
#6  0x665c in regcompile (s=(char *) 0x3fffdc8 "(^#Title:.*\\<WoofUser)|(^#Keywo
rds:.*\\<WoofUser)|(^#Summary:.*\\<WoofUser)", len=73, r=(struct regexp *) 0xc60
e, searchflag=1) (dfa.c line 1713)
#7  0xaa7e in main (argc=3, argv=(char **) 0x3fffd38) (./grep.c line 769)
(gdb)

I would be interested in any fixes or workarounds, as I really need to use this
regexp.

Thanks.

P.S.	I also tried this on a DECstation 5500 running Ultrix and it crashed in
the same way.
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads