Bugzilla will be upgraded to version 5.0 on a still to be determined date in the near future. The original upgrade date has been delayed.
Bug 110524 - egrep segfaults with specific expresson on specific file
egrep segfaults with specific expresson on specific file
Product: Fedora
Classification: Fedora
Component: grep (Show other bugs)
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Tim Waugh
Mike McLean
Depends On:
  Show dependency treegraph
Reported: 2003-11-20 13:58 EST by Rik Faith
Modified: 2007-11-30 17:10 EST (History)
1 user (show)

See Also:
Fixed In Version: 2.5.1-20
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2003-11-21 08:12:04 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
GDB output from grep on RedHat 9 (3.22 KB, text/plain)
2003-11-21 06:36 EST, Paul Nasrat
no flags Details

External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2004:079 normal SHIPPED_LIVE Updated grep package speeds UTF-8 searching 2004-09-01 00:00:00 EDT

  None (edit)
Description Rik Faith 2003-11-20 13:58:04 EST
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.5)
Gecko/20031007 Firebird/0.7

Description of problem:
egrep will core 

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1.curl -v http://www.alephnull.com/bz/World.out.gz -o World.out.gz
2.gunzip World.out.gz
3.egrep '(ld:|gcc:|:[0-9]*:|make.*Error)' World.out


Actual Results:  Thu Nov 20 13:26:25 EST 2003
imake.c:972: warning: string length `1094' is greater than the length
`509' ISO C89 compilers are required to support
                 from Imakefile.c:35:
                 from Imakefile.c:35:
                 from Imakefile.c:35:
main.c:70:23: warning: ISO C does not permit named variadic macros
../../config/makedepend/makedepend  --   -I../..
-I../../exports/include   -Dlinux -D__i386__ -D_POSIX_C_SOURCE=199309L
-D_POSIX_SOURCE -D_XOPEN_SOURCE                          -D_BSD_SOURCE
-D_SVID_SOURCE                             -D_GNU_SOURCE             
   ActionHook.c    Alloc.c         ArgList.c       Callback.c     
ClickTime.c     Composite.c      Constraint.c    Convert.c      
Converters.c    Core.c  Create.c        Destroy.c       Display.c    
  Error.c  Event.c         EventUtil.c     Functions.c     GCManager.c
    Geometry.c      GetActKey.c     GetResList.c    GetValues.c     
HookObj.c       Hooks.c         Initialize.c    Intrinsic.c    
Keyboard.c      Manage.c        NextEvent.c      Object.c       
PassivGrab.c    Pointer.c       Popup.c         PopupCB.c      
RectObj.c       Resources.c     Selection.c      SetSens.c      
SetValues.c     SetWMCW.c       Shell.c         StringDefs.c   
Threads.c       TMaction.c       TMgrab.c        TMkey.c        
TMparse.c       TMprint.c       TMstate.c       VarCreate.c    
VarGet.c        Varargs.c        Vendor.c        sharedlib.c    
XKBMAlloc.c:72: warning: comparison is always true due to limited
range of data type
sm_manager.c:65: warning: nested extern declaration of
TextTr.c:159: warning: string length `2544' is greater than the length
`509' ISO C89 compilers are required to support
TextTr.c:159: warning: string length `2799' is greater than the length
`509' ISO C89 compilers are required to support
xmlparse.c:1331: warning: function returns an aggregate
bdfutils.c:133: warning: nested extern declaration of `MakeAtom'
devices.c:1636: warning: function call has aggregate value
miregion.c:506: warning: inlining failed in call to `miCoalesce'
zsh: 25570 segmentation fault  egrep '(ld:|gcc:|:[0-9]*:|make.*Error)'

Expected Results:  no seg fault

Additional info:

I've used this expression for years to check these files for errors
without problem (they are generated from an XFree86 build).
Comment 1 Paul Nasrat 2003-11-21 06:36:23 EST
Created attachment 96116 [details]
GDB output from grep on RedHat 9

[paul@uruk down]$ rpm -q grep grep-debuginfo
Comment 2 Paul Nasrat 2003-11-21 06:41:06 EST
Note works as expected doing:

LANG=C egrep '(ld:|gcc:|:[0-9]*:|make.*Error)' World.out
Comment 3 Tim Waugh 2003-11-21 08:12:04 EST
Found and fixed two bugs:

inputwcs was getting initialized incorrectly from mb_cache->mblen_buf,
not mb_cache->wcs_buf (duh)

mb_cache->wcs_buf itself was not getting initialized correctly. 
Although the correct amount of memory was allocated, the call to
memcpy forgets to multiply the size by sizeof(wchar_t) (double-duh)

Fixed package is grep-2.5.1-20 (rawhide) / grep-2.5.1-17.2 (updates).
Comment 4 Jay Turner 2004-09-01 22:13:25 EDT
An errata has been issued which should help the problem 
described in this bug report. This report is therefore being 
closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files, 
please follow the link below. You may reopen this bug report 
if the solution does not work for you.


Note You need to log in before you can comment on or make changes to this bug.