Bug 110524 - egrep segfaults with specific expresson on specific file
Summary: egrep segfaults with specific expresson on specific file
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: grep
Version: 1
Hardware: i386
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Tim Waugh
QA Contact: Mike McLean
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2003-11-20 18:58 UTC by Rik Faith
Modified: 2007-11-30 22:10 UTC (History)
1 user (show)

Fixed In Version: 2.5.1-20
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2003-11-21 13:12:04 UTC
Type: ---
Embargoed:


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


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2004:079 0 normal SHIPPED_LIVE Updated grep package speeds UTF-8 searching 2004-09-01 04:00:00 UTC

Description Rik Faith 2003-11-20 18:58:04 UTC
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):
grep-2.5.1-19

How reproducible:
Always

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             
               -DFUNCPROTO=15 -DNARROWPROTO -DXTHREADS  -D_REENTRANT
-DXUSE_MTSAFE_API      -DUSE_SNPRINTF -DLIBXT     -DUSE_MAKEDEPEND --
   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    
ResConfig.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
`_SmsProtocolSetupProc'
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)'
World.out


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 11:36:23 UTC
Created attachment 96116 [details]
GDB output from grep on RedHat 9

[paul@uruk down]$ rpm -q grep grep-debuginfo
grep-2.5.1-17.1
grep-debuginfo-2.5.1-17.1

Comment 2 Paul Nasrat 2003-11-21 11:41:06 UTC
Note works as expected doing:

LANG=C egrep '(ld:|gcc:|:[0-9]*:|make.*Error)' World.out

Comment 3 Tim Waugh 2003-11-21 13:12:04 UTC
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-02 02:13:25 UTC
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.

http://rhn.redhat.com/errata/RHBA-2004-079.html



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