Commit Graph

26 Commits

Author SHA1 Message Date
Pedro F. Giffuni
025069f984 grep: change some int types.
Change several int variables to size_t, ssize_t, or ptrdiff_t.
This should fix the bug described in CVE-2012-5667 when an input
line is so long that its length cannot be stored in an int
variable.

This is based on NetBSD's revision which says:

This change to NetBSD's version of GNU grep 2.5.1 (licenced under
GPLv2) was made without direct reference to any code licenced
under GPLv3.

Obtained from:	NetBSD
MFC after:	3 days
2013-05-20 03:15:25 +00:00
Tim J. Robbins
7c5f1a3fc5 Correctly locate the character preceeding the matched string in -w
mode when in non-UTF-8 multibyte locales (e.g. EUC, GB2312, etc.).

PR:		91909
2006-02-19 04:27:39 +00:00
Tim J. Robbins
ebeecabae3 Fix 'grep -Fw' for encodings other than UTF-8 (RH bug #161700).
PR:		87969
Obtained from:	Fedora (Tim Waugh)
2005-10-25 09:18:50 +00:00
Tim J. Robbins
10f38d95af Pass the RE_ICASE flag to re_set_syntax() as appropriate to fix
case-insensitive matching (-i option) in certain multibyte locales.

Obtained from:	Fedora
2005-05-31 12:49:04 +00:00
Tim J. Robbins
9473343264 Fixed -w handling for EGexecute.
Obtained from:	Fedora (Tim Waugh)
2005-05-14 06:13:23 +00:00
Tim J. Robbins
4475bed3d2 Automatically disable DFA when processing multibyte input. GREP_USE_DFA
environment variable overrides.

Obtained from:	Fedora (Tim Waugh)
2005-05-14 06:12:03 +00:00
Tim J. Robbins
aed59eaecf Better multibyte handling in EGexecute() and Fexecute(). Fixed -Fi for
multibyte input (RH bug #143079).

Obtained from:	Fedora (Jakub Jelinek, Tim Waugh)
2005-05-14 06:09:12 +00:00
Tim J. Robbins
1bd8c187c0 Fixed a bug in the fgrep patch, exposed by the dfa-optional patch
(RH bug #138558). Removed bogus part of grep-2.5.1-fgrep patch.

Obtained from:	Fedora (Jakub Jelinek, Tim Waugh)
2005-05-14 04:17:07 +00:00
Tim J. Robbins
52e523ead7 Remove mb-caching hack.
Obtained from:	Fedora (Tim Waugh)
2005-05-14 03:02:22 +00:00
Tim J. Robbins
2af417add4 Make grep run much (~10x) faster in multibyte locales by caching the wide
character representation of input data across calls to dfaexec(), and by
caching the lengths of character across calls to check_multibyte_string().

Obtained from:	Fedora (Tim Waugh)
2004-07-04 16:16:59 +00:00
Tim J. Robbins
7358ecc6b6 Avoid accessing accessing memory past the end of mb_properties in the
degenerate case of fgrep with an empty pattern in a multibyte locale.
Found by phkmalloc.
2004-07-04 14:00:25 +00:00
Tim J. Robbins
91a4826a49 Improve case-insensitive matching in multibyte locales.
Obtained from:	Isamu Hasegawa (IBM) via Fedora
2004-07-04 11:58:10 +00:00
Tim J. Robbins
a7e3f3f0db Fix failure of fgrep to report some matches (Red Hat bug #116909).
Obtained from:	Fedora (Tim Waugh)
2004-07-04 11:33:49 +00:00
Tim J. Robbins
e5978bf334 Merge local changes. 2004-07-04 10:02:03 +00:00
Andrey A. Chernov
0416b7503d Merge conflicts, upgrade 2004-03-01 08:37:20 +00:00
Andrey A. Chernov
90fc35042b 1) Remove files no longer needed.
2) Switch back to regex.h
2004-02-16 22:43:05 +00:00
Ruslan Ermilov
73d1eabc26 Merge FreeBSD changes into 2.4d. 2000-01-31 13:28:57 +00:00
David E. O'Brien
7e5b33c6cd Merge FreeBSD chagnes into GNU grep 2.4. 2000-01-04 03:25:40 +00:00
David E. O'Brien
dd5c240f7a Merge FreeBSD changes into 2.3:
* rev 1.2 - use -lgnuregex

FreeBSD changes OBE'ed by 2.3:
* revs 1.4-5 - icase searches & ctype macro changes, fuctionality moved
               elsewhere.
* rev 1.3 - Remove trailing whitespace.  The GNU Grep maintainers did this
            for us.

Submitted by:	ru
1999-11-21 01:15:40 +00:00
Peter Wemm
c18f2d82a5 Back out the botched attempt to update to gnu grep 2.3 (lots of history
was lost).  Restore original version to try and avoid breaking the build
while David O'brien does a proper set of imports and merges.

Requested by:	obrien
1999-11-20 09:40:28 +00:00
Ruslan Ermilov
be59282c27 Upgrade grep to version 2.3 1999-10-28 10:34:55 +00:00
Andrey A. Chernov
8b50620f9a Add (unsigned char) casts to ctype macros 1997-10-23 01:43:00 +00:00
Andrey A. Chernov
9203a11a55 Add setlocale LC_CTYPE
Fix icase searches for 8bit charsets
1995-10-28 19:16:14 +00:00
Rodney W. Grimes
4399be3cbd Remove trailing whitespace. 1995-05-30 05:05:38 +00:00
Andrey A. Chernov
e88843d3cf Use -lgnuregex
Tune for 8bit ctype
1995-01-11 05:07:00 +00:00
Nate Williams
c0db29cc59 Update GNU grep to version 2.0 1993-07-06 18:45:26 +00:00