From 13d99c0bcdf1d503bacbd41944bde684ee05dae6 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Nov 19 2015 03:35:01 +0000 Subject: import grep-2.20-2.el7 --- diff --git a/SOURCES/grep-2.20-CVE-2015-1345.patch b/SOURCES/grep-2.20-CVE-2015-1345.patch new file mode 100644 index 0000000..d7e591d --- /dev/null +++ b/SOURCES/grep-2.20-CVE-2015-1345.patch @@ -0,0 +1,90 @@ +--- a/THANKS ++++ b/THANKS +@@ -70,6 +70,7 @@ Mike Frysinger + Miles Bader + Mirraz Mirraz + Nelson H. F. Beebe ++Nima Aghdaii + Olaf Kirch + Paolo Bonzini + Paul Eggert +--- a/src/kwset.c ++++ b/src/kwset.c +@@ -643,6 +643,8 @@ bmexec_trans (kwset_t kwset, char const *text, size_t size) + if (! tp) + return -1; + tp++; ++ if (ep <= tp) ++ break; + } + } + } +--- a/tests/Makefile.am ++++ b/tests/Makefile.am +@@ -72,6 +72,7 @@ TESTS = \ + inconsistent-range \ + invalid-multibyte-infloop \ + khadafy \ ++ kwset-abuse \ + long-line-vs-2GiB-read \ + max-count-overread \ + max-count-vs-context \ +--- a/tests/Makefile.in ++++ b/tests/Makefile.in +@@ -1371,6 +1371,7 @@ TESTS = \ + inconsistent-range \ + invalid-multibyte-infloop \ + khadafy \ ++ kwset-abuse \ + long-line-vs-2GiB-read \ + max-count-overread \ + max-count-vs-context \ +@@ -2021,6 +2022,13 @@ khadafy.log: khadafy + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) ++kwset-abuse.log: kwset-abuse ++ @p='kwset-abuse'; \ ++ b='kwset-abuse'; \ ++ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ ++ --log-file $$b.log --trs-file $$b.trs \ ++ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ ++ "$$tst" $(AM_TESTS_FD_REDIRECT) + long-line-vs-2GiB-read.log: long-line-vs-2GiB-read + @p='long-line-vs-2GiB-read'; \ + b='long-line-vs-2GiB-read'; \ +--- a/dev/null ++++ b/tests/kwset-abuse +@@ -0,0 +1,32 @@ ++#! /bin/sh ++# Evoke a segfault in a hard-to-reach code path of kwset.c. ++# This bug affected grep versions 2.19 through 2.21. ++# ++# Copyright (C) 2015 Free Software Foundation, Inc. ++# ++# This program is free software: you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation, either version 3 of the License, or ++# (at your option) any later version. ++ ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++ ++# You should have received a copy of the GNU General Public License ++# along with this program. If not, see . ++ ++. "${srcdir=.}/init.sh"; path_prepend_ ../src ++ ++fail=0 ++ ++# This test case chooses a haystack of size 260,000, since prodding ++# with gdb showed a reallocation slightly larger than that in fillbuf. ++# To reach the buggy code, the needle must have length < 1/11 that of ++# the haystack, and 10,000 is a nice round number that fits the bill. ++printf '%0260000dXy\n' 0 | grep -F $(printf %010000dy 0) ++ ++test $? = 1 || fail=1 ++ ++Exit $fail diff --git a/SOURCES/grep-2.20-man-fixed-regexp-option.patch b/SOURCES/grep-2.20-man-fixed-regexp-option.patch new file mode 100644 index 0000000..93b1e7b --- /dev/null +++ b/SOURCES/grep-2.20-man-fixed-regexp-option.patch @@ -0,0 +1,22 @@ +diff --git a/doc/grep.in.1 b/doc/grep.in.1 +index 3e6a8cf..480f205 100644 +--- a/doc/grep.in.1 ++++ b/doc/grep.in.1 +@@ -97,13 +97,15 @@ as an extended regular expression (ERE, see below). + .RB ( \-E + is specified by \s-1POSIX\s0.) + .TP +-.BR \-F ", " \-\^\-fixed\-strings ++.BR \-F ", " \-\^\-fixed\-strings ", " \-\^\-fixed\-regexp + Interpret + .I PATTERN + as a list of fixed strings, separated by newlines, + any of which is to be matched. + .RB ( \-F +-is specified by \s-1POSIX\s0.) ++is specified by \s-1POSIX\s0, ++.BR \-\^\-fixed\-regexp ++is an obsoleted alias, please do not use it in new scripts.) + .TP + .BR \-G ", " \-\^\-basic\-regexp + Interpret diff --git a/SOURCES/grep-2.20-pcre-backported-fixes.patch b/SOURCES/grep-2.20-pcre-backported-fixes.patch new file mode 100644 index 0000000..008eae0 --- /dev/null +++ b/SOURCES/grep-2.20-pcre-backported-fixes.patch @@ -0,0 +1,389 @@ +diff --git a/src/grep.h b/src/grep.h +index 4935872..729c906 100644 +--- a/src/grep.h ++++ b/src/grep.h +@@ -27,4 +27,19 @@ extern int match_words; /* -w */ + extern int match_lines; /* -x */ + extern unsigned char eolbyte; /* -z */ + ++/* An enum textbin describes the file's type, inferred from data read ++ before the first line is selected for output. */ ++enum textbin ++ { ++ /* Binary, as it contains null bytes and the -z option is not in effect, ++ or it contains encoding errors. */ ++ TEXTBIN_BINARY = -1, ++ ++ /* Not known yet. Only text has been seen so far. */ ++ TEXTBIN_UNKNOWN = 0, ++ ++ /* Text. */ ++ TEXTBIN_TEXT = 1 ++ }; ++ + #endif +diff --git a/src/pcresearch.c b/src/pcresearch.c +index 820dd00..9938ffc 100644 +--- a/src/pcresearch.c ++++ b/src/pcresearch.c +@@ -33,13 +33,19 @@ static pcre *cre; + /* Additional information about the pattern. */ + static pcre_extra *extra; + +-# ifdef PCRE_STUDY_JIT_COMPILE +-static pcre_jit_stack *jit_stack; +-# else ++# ifndef PCRE_STUDY_JIT_COMPILE + # define PCRE_STUDY_JIT_COMPILE 0 + # endif + #endif + ++/* Table, indexed by ! (flag & PCRE_NOTBOL), of whether the empty ++ string matches when that flag is used. */ ++static int empty_match[2]; ++ ++/* This must be at least 2; everything after that is for performance ++ in pcre_exec. */ ++enum { NSUB = 300 }; ++ + void + Pcompile (char const *pattern, size_t size) + { +@@ -52,13 +58,17 @@ Pcompile (char const *pattern, size_t size) + char const *ep; + char *re = xnmalloc (4, size + 7); + int flags = (PCRE_MULTILINE +- | (match_icase ? PCRE_CASELESS : 0) +- | (using_utf8 () ? PCRE_UTF8 : 0)); ++ | (match_icase ? PCRE_CASELESS : 0)); + char const *patlim = pattern + size; + char *n = re; + char const *p; + char const *pnul; + ++ if (using_utf8 ()) ++ flags |= PCRE_UTF8; ++ else if (MB_CUR_MAX != 1) ++ error (EXIT_TROUBLE, 0, _("-P supports only unibyte and UTF-8 locales")); ++ + /* FIXME: Remove these restrictions. */ + if (memchr (pattern, '\n', size)) + error (EXIT_TROUBLE, 0, _("the -P option only supports a single pattern")); +@@ -114,14 +124,20 @@ Pcompile (char const *pattern, size_t size) + /* A 32K stack is allocated for the machine code by default, which + can grow to 512K if necessary. Since JIT uses far less memory + than the interpreter, this should be enough in practice. */ +- jit_stack = pcre_jit_stack_alloc (32 * 1024, 512 * 1024); ++ pcre_jit_stack *jit_stack = pcre_jit_stack_alloc (32 * 1024, 512 * 1024); + if (!jit_stack) + error (EXIT_TROUBLE, 0, + _("failed to allocate memory for the PCRE JIT stack")); + pcre_assign_jit_stack (extra, NULL, jit_stack); + } ++ + # endif + free (re); ++ ++ int sub[NSUB]; ++ empty_match[false] = pcre_exec (cre, extra, "", 0, 0, ++ PCRE_NOTBOL, sub, NSUB); ++ empty_match[true] = pcre_exec (cre, extra, "", 0, 0, 0, sub, NSUB); + #endif /* HAVE_LIBPCRE */ + } + +@@ -134,36 +150,110 @@ Pexecute (char const *buf, size_t size, size_t *match_size, + error (EXIT_TROUBLE, 0, _("internal error")); + return -1; + #else +- /* This array must have at least two elements; everything after that +- is just for performance improvement in pcre_exec. */ +- int sub[300]; +- +- const char *line_buf, *line_end, *line_next; ++ int sub[NSUB]; ++ char const *p = start_ptr ? start_ptr : buf; ++ bool bol = p[-1] == eolbyte; ++ char const *line_start = buf; + int e = PCRE_ERROR_NOMATCH; +- ptrdiff_t start_ofs = start_ptr ? start_ptr - buf : 0; ++ char const *line_end; + +- /* PCRE can't limit the matching to single lines, therefore we have to +- match each line in the buffer separately. */ +- for (line_next = buf; +- e == PCRE_ERROR_NOMATCH && line_next < buf + size; +- start_ofs -= line_next - line_buf) ++ /* If the input type is unknown, the caller is still testing the ++ input, which means the current buffer cannot contain encoding ++ errors and a multiline search is typically more efficient. ++ Otherwise, a single-line search is typically faster, so that ++ pcre_exec doesn't waste time validating the entire input ++ buffer. */ ++ bool multiline = TEXTBIN_UNKNOWN; ++ ++ for (; p < buf + size; p = line_start = line_end + 1) + { +- line_buf = line_next; +- line_end = memchr (line_buf, eolbyte, (buf + size) - line_buf); +- if (line_end == NULL) +- line_next = line_end = buf + size; +- else +- line_next = line_end + 1; ++ bool too_big; + +- if (start_ptr && start_ptr >= line_end) +- continue; ++ if (multiline) ++ { ++ size_t pcre_size_max = MIN (INT_MAX, SIZE_MAX - 1); ++ size_t scan_size = MIN (pcre_size_max + 1, buf + size - p); ++ line_end = memrchr (p, eolbyte, scan_size); ++ too_big = ! line_end; ++ } ++ else ++ { ++ line_end = memchr (p, eolbyte, buf + size - p); ++ too_big = INT_MAX < line_end - p; ++ } + +- if (INT_MAX < line_end - line_buf) ++ if (too_big) + error (EXIT_TROUBLE, 0, _("exceeded PCRE's line length limit")); + +- e = pcre_exec (cre, extra, line_buf, line_end - line_buf, +- start_ofs < 0 ? 0 : start_ofs, 0, +- sub, sizeof sub / sizeof *sub); ++ for (;;) ++ { ++ /* Skip past bytes that are easily determined to be encoding ++ errors, treating them as data that cannot match. This is ++ faster than having pcre_exec check them. */ ++ while (mbclen_cache[to_uchar (*p)] == (size_t) -1) ++ { ++ p++; ++ bol = false; ++ } ++ ++ /* Check for an empty match; this is faster than letting ++ pcre_exec do it. */ ++ int search_bytes = line_end - p; ++ if (search_bytes == 0) ++ { ++ sub[0] = sub[1] = 0; ++ e = empty_match[bol]; ++ break; ++ } ++ ++ int options = 0; ++ if (!bol) ++ options |= PCRE_NOTBOL; ++ if (multiline) ++ options |= PCRE_NO_UTF8_CHECK; ++ ++ e = pcre_exec (cre, extra, p, search_bytes, 0, ++ options, sub, NSUB); ++ if (e != PCRE_ERROR_BADUTF8) ++ { ++ if (0 < e && multiline && sub[1] - sub[0] != 0) ++ { ++ char const *nl = memchr (p + sub[0], eolbyte, ++ sub[1] - sub[0]); ++ if (nl) ++ { ++ /* This match crosses a line boundary; reject it. */ ++ p += sub[0]; ++ line_end = nl; ++ continue; ++ } ++ } ++ break; ++ } ++ int valid_bytes = sub[0]; ++ ++ /* Try to match the string before the encoding error. ++ Again, handle the empty-match case specially, for speed. */ ++ if (valid_bytes == 0) ++ { ++ sub[1] = 0; ++ e = empty_match[bol]; ++ } ++ else ++ e = pcre_exec (cre, extra, p, valid_bytes, 0, ++ options | PCRE_NO_UTF8_CHECK | PCRE_NOTEOL, ++ sub, NSUB); ++ if (e != PCRE_ERROR_NOMATCH || valid_bytes < 0) ++ break; ++ ++ /* Treat the encoding error as data that cannot match. */ ++ p += valid_bytes + 1; ++ bol = false; ++ } ++ ++ if (e != PCRE_ERROR_NOMATCH) ++ break; ++ bol = true; + } + + if (e <= 0) +@@ -171,7 +261,7 @@ Pexecute (char const *buf, size_t size, size_t *match_size, + switch (e) + { + case PCRE_ERROR_NOMATCH: +- return -1; ++ break; + + case PCRE_ERROR_NOMEMORY: + error (EXIT_TROUBLE, 0, _("memory exhausted")); +@@ -180,10 +270,6 @@ Pexecute (char const *buf, size_t size, size_t *match_size, + error (EXIT_TROUBLE, 0, + _("exceeded PCRE's backtracking limit")); + +- case PCRE_ERROR_BADUTF8: +- error (EXIT_TROUBLE, 0, +- _("invalid UTF-8 byte sequence in input")); +- + default: + /* For now, we lump all remaining PCRE failures into this basket. + If anyone cares to provide sample grep usage that can trigger +@@ -192,30 +278,33 @@ Pexecute (char const *buf, size_t size, size_t *match_size, + error (EXIT_TROUBLE, 0, _("internal PCRE error: %d"), e); + } + +- /* NOTREACHED */ + return -1; + } + else + { +- /* Narrow down to the line we've found. */ +- char const *beg = line_buf + sub[0]; +- char const *end = line_buf + sub[1]; +- char const *buflim = buf + size; +- char eol = eolbyte; +- if (!start_ptr) ++ char const *matchbeg = p + sub[0]; ++ char const *matchend = p + sub[1]; ++ char const *beg; ++ char const *end; ++ if (start_ptr) + { +- /* FIXME: The case when '\n' is not found indicates a bug: +- Since grep is line oriented, the match should never contain +- a newline, so there _must_ be a newline following. +- */ +- if (!(end = memchr (end, eol, buflim - end))) +- end = buflim; +- else +- end++; +- while (buf < beg && beg[-1] != eol) +- --beg; ++ beg = matchbeg; ++ end = matchend; ++ } ++ else if (multiline) ++ { ++ char const *prev_nl = memrchr (line_start - 1, eolbyte, ++ matchbeg - (line_start - 1)); ++ char const *next_nl = memchr (matchend, eolbyte, ++ line_end + 1 - matchend); ++ beg = prev_nl + 1; ++ end = next_nl + 1; ++ } ++ else ++ { ++ beg = line_start; ++ end = line_end + 1; + } +- + *match_size = end - beg; + return beg - buf; + } +diff --git a/src/search.h b/src/search.h +index 14877bc..e671bea 100644 +--- a/src/search.h ++++ b/src/search.h +@@ -45,6 +45,7 @@ extern void kwsinit (kwset_t *); + + extern char *mbtoupper (char const *, size_t *, mb_len_map_t **); + extern void build_mbclen_cache (void); ++extern size_t mbclen_cache[]; + extern ptrdiff_t mb_goback (char const **, char const *, char const *); + extern wint_t mb_prev_wc (char const *, char const *, char const *); + extern wint_t mb_next_wc (char const *, char const *); +diff --git a/src/searchutils.c b/src/searchutils.c +index 5eb9a12..aba9335 100644 +--- a/src/searchutils.c ++++ b/src/searchutils.c +@@ -22,7 +22,7 @@ + + #define NCHAR (UCHAR_MAX + 1) + +-static size_t mbclen_cache[NCHAR]; ++size_t mbclen_cache[NCHAR]; + + void + kwsinit (kwset_t *kwset) +diff --git a/tests/pcre-infloop b/tests/pcre-infloop +index 1b33e72..8054844 100755 +--- a/tests/pcre-infloop ++++ b/tests/pcre-infloop +@@ -18,16 +18,16 @@ + # along with this program. If not, see . + + . "${srcdir=.}/init.sh"; path_prepend_ ../src +-require_pcre_ + require_timeout_ + require_en_utf8_locale_ + require_compiled_in_MB_support ++LC_ALL=en_US.UTF-8 require_pcre_ + + printf 'a\201b\r' > in || framework_failure_ + + fail=0 + + LC_ALL=en_US.UTF-8 timeout 3 grep -P 'a.?..b' in +-test $? = 2 || fail_ "libpcre's match function appears to infloop" ++test $? = 1 || fail_ "libpcre's match function appears to infloop" + + Exit $fail +diff --git a/tests/pcre-invalid-utf8-input b/tests/pcre-invalid-utf8-input +index 913e8ee..abcc7e8 100755 +--- a/tests/pcre-invalid-utf8-input ++++ b/tests/pcre-invalid-utf8-input +@@ -8,14 +8,19 @@ + # notice and this notice are preserved. + + . "${srcdir=.}/init.sh"; path_prepend_ ../src +-require_pcre_ ++require_timeout_ + require_en_utf8_locale_ ++require_compiled_in_MB_support ++LC_ALL=en_US.UTF-8 require_pcre_ + + fail=0 + +-printf 'j\202\nj\n' > in || framework_failure_ ++printf 'j\202j\nj\nk\202\n' > in || framework_failure_ + +-LC_ALL=en_US.UTF-8 grep -P j in +-test $? -eq 2 || fail=1 ++LC_ALL=en_US.UTF-8 timeout 3 grep -P j in ++test $? -eq 0 || fail=1 ++ ++LC_ALL=en_US.UTF-8 timeout 3 grep -P 'k$' in ++test $? -eq 1 || fail=1 + + Exit $fail +diff --git a/tests/pcre-utf8 b/tests/pcre-utf8 +index 41676f4..2dda116 100755 +--- a/tests/pcre-utf8 ++++ b/tests/pcre-utf8 +@@ -8,8 +8,8 @@ + # notice and this notice are preserved. + + . "${srcdir=.}/init.sh"; path_prepend_ ../src +-require_pcre_ + require_en_utf8_locale_ ++LC_ALL=en_US.UTF-8 require_pcre_ + + fail=0 + diff --git a/SOURCES/grep-2.20-w-multibyte-fix.patch b/SOURCES/grep-2.20-w-multibyte-fix.patch new file mode 100644 index 0000000..403d9c0 --- /dev/null +++ b/SOURCES/grep-2.20-w-multibyte-fix.patch @@ -0,0 +1,145 @@ +--- a/src/dfa.c ++++ b/src/dfa.c +@@ -1238,6 +1238,20 @@ parse_bracket_exp (void) + return CSET + charclass_index (ccl); + } + ++#define PUSH_LEX_STATE(s) \ ++ do \ ++ { \ ++ char const *lexptr_saved = lexptr; \ ++ size_t lexleft_saved = lexleft; \ ++ lexptr = (s); \ ++ lexleft = strlen (lexptr) ++ ++#define POP_LEX_STATE() \ ++ lexptr = lexptr_saved; \ ++ lexleft = lexleft_saved; \ ++ } \ ++ while (0) ++ + static token + lex (void) + { +@@ -1485,20 +1499,6 @@ lex (void) + return lasttok = CSET + charclass_index (ccl); + } + +-#define PUSH_LEX_STATE(s) \ +- do \ +- { \ +- char const *lexptr_saved = lexptr; \ +- size_t lexleft_saved = lexleft; \ +- lexptr = (s); \ +- lexleft = strlen (lexptr) +- +-#define POP_LEX_STATE() \ +- lexptr = lexptr_saved; \ +- lexleft = lexleft_saved; \ +- } \ +- while (0) +- + /* FIXME: see if optimizing this, as is done with ANYCHAR and + add_utf8_anychar, makes sense. */ + +@@ -1518,14 +1518,33 @@ lex (void) + case 'W': + if (!backslash || (syntax_bits & RE_NO_GNU_OPS)) + goto normal_char; +- zeroset (ccl); +- for (c2 = 0; c2 < NOTCHAR; ++c2) +- if (IS_WORD_CONSTITUENT (c2)) +- setbit (c2, ccl); +- if (c == 'W') +- notset (ccl); ++ ++ if (!dfa->multibyte) ++ { ++ zeroset (ccl); ++ for (c2 = 0; c2 < NOTCHAR; ++c2) ++ if (IS_WORD_CONSTITUENT (c2)) ++ setbit (c2, ccl); ++ if (c == 'W') ++ notset (ccl); ++ laststart = false; ++ return lasttok = CSET + charclass_index (ccl); ++ } ++ ++ /* FIXME: see if optimizing this, as is done with ANYCHAR and ++ add_utf8_anychar, makes sense. */ ++ ++ /* \w and \W are documented to be equivalent to [_[:alnum:]] and ++ [^_[:alnum:]] respectively, so tell the lexer to process those ++ strings, each minus its "already processed" '['. */ ++ PUSH_LEX_STATE (c == 'w' ? "_[:alnum:]]" : "^_[:alnum:]]"); ++ ++ lasttok = parse_bracket_exp (); ++ ++ POP_LEX_STATE (); ++ + laststart = false; +- return lasttok = CSET + charclass_index (ccl); ++ return lasttok; + + case '[': + if (backslash) +--- a/tests/Makefile.am ++++ b/tests/Makefile.am +@@ -110,6 +110,7 @@ TESTS = \ + warn-char-classes \ + word-delim-multibyte \ + word-multi-file \ ++ word-multibyte \ + yesno + + EXTRA_DIST = \ +--- a/tests/Makefile.in ++++ b/tests/Makefile.in +@@ -1409,6 +1409,7 @@ TESTS = \ + warn-char-classes \ + word-delim-multibyte \ + word-multi-file \ ++ word-multibyte \ + yesno + + EXTRA_DIST = \ +@@ -2286,6 +2287,13 @@ word-multi-file.log: word-multi-file + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) ++word-multibyte.log: word-multibyte ++ @p='word-multibyte'; \ ++ b='word-multibyte'; \ ++ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ ++ --log-file $$b.log --trs-file $$b.trs \ ++ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ ++ "$$tst" $(AM_TESTS_FD_REDIRECT) + yesno.log: yesno + @p='yesno'; \ + b='yesno'; \ +--- a/dev/null ++++ a/tests/word-multibyte +@@ -0,0 +1,23 @@ ++#!/bin/sh ++# This would fail for grep-2.20 ++. "${srcdir=.}/init.sh"; path_prepend_ ../src ++ ++require_en_utf8_locale_ ++ ++printf '\xc3\xa1\n' > in || framework_failure_ ++LC_ALL=en_US.UTF-8 ++export LC_ALL ++ ++fail=0 ++ ++for LOC in en_US.UTF-8 zh_CN $LOCALE_FR_UTF8; do ++ out=out1-$LOC ++ LC_ALL=$LOC grep '\w' in >$out || fail=1 ++ compare in $out || fail=1 ++ ++ out=out2-$LOC ++ LC_ALL=$LOC grep '\W' in >$out && fail=1 ++ compare /dev/null $out || fail=1 ++done ++ ++Exit $fail diff --git a/SPECS/grep.spec b/SPECS/grep.spec index 1a9490f..8f9c6e3 100644 --- a/SPECS/grep.spec +++ b/SPECS/grep.spec @@ -3,7 +3,7 @@ Summary: Pattern matching utilities Name: grep Version: 2.20 -Release: 1%{?dist} +Release: 2%{?dist} License: GPLv3+ Group: Applications/Text Source: ftp://ftp.gnu.org/pub/gnu/grep/grep-%{version}.tar.xz @@ -15,11 +15,19 @@ Source4: grepconf.sh Patch0: grep-2.20-man-fix-gs.patch # upstream ticket 39445 Patch1: grep-2.20-help-align.patch +# rhbz#1159012 +Patch2: grep-2.20-w-multibyte-fix.patch +# rhbz#1103259 +Patch3: grep-2.20-man-fixed-regexp-option.patch +# rhbz#1217080 +Patch4: grep-2.20-pcre-backported-fixes.patch +# rhbz#1194315 +Patch5: grep-2.20-CVE-2015-1345.patch URL: http://www.gnu.org/software/grep/ Requires(post): /sbin/install-info Requires(preun): /sbin/install-info BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) -BuildRequires: pcre-devel >= 3.9-10, texinfo, gettext +BuildRequires: pcre-devel >= 7.8-7, texinfo, gettext BuildRequires: autoconf automake # https://fedorahosted.org/fpc/ticket/174 Provides: bundled(gnulib) @@ -35,6 +43,15 @@ GNU grep is needed by many scripts, so it shall be installed on every system. %setup -q %patch0 -p1 -b .man-fix-gs %patch1 -p1 -b .help-align +%patch2 -p1 -b .w-multibyte-fix +%patch3 -p1 -b .man-fixed-rexexp-option +%patch4 -p1 -b .pcre-backported-fixes +%patch5 -p1 -b .CVE-2015-1345 + +chmod 755 tests/word-multibyte +chmod 755 tests/pcre-invalid-utf8-input +chmod 755 tests/pcre-utf8 +chmod 755 tests/kwset-abuse %build %global BUILD_FLAGS $RPM_OPT_FLAGS @@ -88,6 +105,19 @@ fi %{_libexecdir}/grepconf.sh %changelog +* Wed Apr 29 2015 Jaroslav Škarvada - 2.20-2 +- Fixed invalid UTF-8 byte sequence error in PCRE mode + (by pcre-backported-fixes patch) + Resolves: rhbz#1217080 +- Fixed buffer overrun for grep -F + Resolves: CVE-2015-1345 +- Fixed \w and \W behaviour in multibyte locales + Resolves: rhbz#1159012 +- Documented --fixed-regexp option + Resolves: rhbz#1103259 +- Updated pcre buildrequires to require pcre-devel >= 7.8-7 + Related: rhbz#1217080 + * Fri Sep 5 2014 Jaroslav Škarvada - 2.20-1 - New version Resolves: rhbz#1123005