bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: grep 2.4.2 bug (and patch)


From: Alain Magloire
Subject: Re: grep 2.4.2 bug (and patch)
Date: Sun, 29 Jul 2001 11:25:06 -0400 (EDT)

> 
> Hi --

Bonjour

> 
> I found a small bug in the GNU grep 2.4.2, which may have gone unnoticed
> because it only causes a failure if building on a system with large
> files enabled (e.g. an "off_t" is a "long long" rather than a "long").
> savedir() takes on off_t argument, but in grepdir() the parameter
> is cast to an (unsigned).  Well, if an off_t is larger than an int,
> the value gets truncated.  This would not normally have an effect on a
> little-endian platform (unless the file is >2GB), but on a big-endian
> system it will always fail.  The external effect is that
> "grep -r foo dir_name" fails with ENOMEM (from malloc() within savedir()).
> 
> Looking at the code, I see that the cast is not necessary to begin with.
> Hence, the fix is simply to remove it, as in the patch below.


Thanks, for taking the time to look at this.
Patch applied, in the cvs Repository.

The code is available through
anonymous CVS.
$ cvs -d :pserver:address@hidden:/cvs login
Password: [just hit enter]
$ cvs -d :pserver:address@hidden:/cvs checkout grep


--
alain




reply via email to

[Prev in Thread] Current Thread [Next in Thread]