SHA256
1
0
forked from pool/grep

Accepting request 342139 from home:AndreasStieger:branches:Base:System

GNU grep 2.22

OBS-URL: https://build.opensuse.org/request/show/342139
OBS-URL: https://build.opensuse.org/package/show/Base:System/grep?expand=0&rev=62
This commit is contained in:
Marcus Meissner 2015-11-03 13:41:47 +00:00 committed by Git OBS Bridge
parent 8e2acdccba
commit 1d22e4af0e
8 changed files with 29 additions and 184 deletions

View File

@ -1,15 +0,0 @@
Subject: http://comments.gmane.org/gmane.comp.lib.gnulib.bugs/35272
Index: grep-2.21/build-aux/update-copyright
===================================================================
--- grep-2.21.orig/build-aux/update-copyright
+++ grep-2.21/build-aux/update-copyright
@@ -124,7 +124,7 @@ use strict;
use warnings;
my $copyright_re = 'Copyright';
-my $circle_c_re = '(?:\([cC]\)|@copyright{}|©)';
+my $circle_c_re = '(?:\([cC]\)|@copyright\{}|©)';
my $holder = $ENV{UPDATE_COPYRIGHT_HOLDER};
$holder ||= 'Free Software Foundation, Inc.';
my $prefix_max = 5;

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:5244a11c00dee8e7e5e714b9aaa053ac6cbfa27e104abee20d3c778e4bb0e5de
size 1261548

View File

@ -1,19 +0,0 @@
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.22 (GNU/Linux)
iQJ8BAABCgBmBQJUcjFLXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w
ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXQxNTVEM0ZDNTAwQzgzNDQ4NkQxRUVBNjc3
RkQ5RkNDQjAwMEJFRUVFAAoJEH/Z/MsAC+7u9NAQAJmCyuYgxQ8QOiThd/OC6chW
V0IoCekv778TLHOpIlfHMdBEkkY1i4hH8ldeYXzFHj7Ryi9IOhrz7fEwYSvru5Fw
Tq7trh50a63ZLeNesGE1CKVKPvdf0wSPirQDtfKhZm8FM0xrpdSOvLVKTEfXcMNX
1nhc6atq3TI8T2CQoHToDEWcEh1RsqhV6yU/j17GCZyJXWklepSG42e6DIiuWwmg
OVS6+mzsph8F752WglxL2iyZZxcKHzEZm/MdlYpYHhMH+vUBBFmGdy9d2zHBHWoy
uQO6knA4hylVTEyhNXZxD/yALnV8O+QE27ihdbugYIYH00DPZ0n3IhXBiCmT+I3D
LUjgZ7WOI/n6nNlGAPXl997cdjD24dupYweOSIMm2nluiymODDafEAPbvuLR+D8z
XzPl2vZu3fvIIqUF9pyXdWmeDnZFtTprhPzo6BYpBw8HgBVr0TUF5rGfchq2RYF2
WbhqLiOAaz7DFV/DTE5j5vXcP9k1iaYOu6w9qjNDWhpTdxcnYh/IsMS1vDkhAM36
64P/RcC3Tr8ZZz6zVs8RW7i0dmnB/mkw4h21Ydx1348kavA0PgCH/C1y6q7j1gOe
A7IECF3ElsFPL8D5L7sE41zX7i91qftSL9euO0dlN8VAOl7sg7J6sKHe8n+4tN4Q
hOcmxpUb+Cb6DHuiaxeq
=dHus
-----END PGP SIGNATURE-----

3
grep-2.22.tar.xz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:ca91d22f017bfcb503d4bc3b44295491c89a33a3df0c3d8b8614f2d3831836eb
size 1297864

16
grep-2.22.tar.xz.sig Normal file
View File

@ -0,0 +1,16 @@
-----BEGIN PGP SIGNATURE-----
iQIcBAABCgAGBQJWNsXCAAoJEH/Z/MsAC+7uciYQAJAjh3YMRjNnDZIgfcXi2Ker
LPdXK0fxhujHjlbgy0XK3GeAvdOcve8lq/g4Y5jqudF77t24LmwTEmp+ZBvPd0hC
7v2qy6KgbjDlho4D6moWghLZzQuzTtFPQ19pU9FDuUsmwh8ZftKKjowJSPXdfv8p
l7xFefyflnU9CZinmoD7cvbZxtNatrLUJ1ubWNtIL6M1vqMKUhygbmivqrr0m1kt
6cxaTF4FOgfie5VjaDLYAYPmIX7JiAJMUtfIksZNmCF1UhcD6Ux9Cy4pZaEotrhJ
/B07Xh3/ol4h1P93k2julYCkQiZkfdn/xl9cXZbw4vHfwR9ri7uAe0JoVejRjj19
rVsyQJK8ia6myYdAHogNhH82Y/00QhpN/ENf3H/534B+eDXV+P/ZnnebGwviZ2OT
hbWUJNgPkMy6nR/e++vGm6Giv97PcJcbWJ0hhDxtpJZHePcFkkd7BxHfo4UkGD5L
3TSxlPcwGtrJdlBBlRuQaclBzhmTDsgQ43/e0ffXzVNx6D2KbsQq92Ep6SNQHfeb
CPYKc/WbLqZ+JYI5zXT1nqYlIOuv9Q7m590vuwbs0bV2Cgk0XVf8C6QglegzK6jN
Stmv54kaF0BAjXTnPGFFnpc5g2OkLrqBgsIjEfg5wuhft8qKFQZ2As/ZuwrJvdv2
duC+qmM+cb/kX79E3HAy
=y59/
-----END PGP SIGNATURE-----

View File

@ -1,141 +0,0 @@
From 83a95bd8c8561875b948cadd417c653dbe7ef2e2 Mon Sep 17 00:00:00 2001
From: Yuliy Pisetsky <ypisetsky@fb.com>
Date: Thu, 1 Jan 2015 15:36:55 -0800
Subject: [PATCH] grep -F: fix a heap buffer (read) overrun
grep's read buffer is often filled to its full size, except when
reading the final buffer of a file. In that case, the number of
bytes read may be far less than the size of the buffer. However, for
certain unusual pattern/text combinations, grep -F would mistakenly
examine bytes in that uninitialized region of memory when searching
for a match. With carefully chosen inputs, one can cause grep -F to
read beyond the end of that buffer altogether. This problem arose via
commit v2.18-90-g73893ff with the introduction of a more efficient
heuristic using what is now the memchr_kwset function. The use of
that function in bmexec_trans could leave TP much larger than EP,
and the subsequent call to bm_delta2_search would mistakenly access
beyond end of the main input read buffer.
* src/kwset.c (bmexec_trans): When TP reaches or exceeds EP,
do not call bm_delta2_search.
* tests/kwset-abuse: New file.
* tests/Makefile.am (TESTS): Add it.
* THANKS.in: Update.
* NEWS (Bug fixes): Mention it.
Prior to this patch, this command would trigger a UMR:
printf %0360db 0 | valgrind src/grep -F $(printf %019dXb 0)
Use of uninitialised value of size 8
at 0x4142BE: bmexec_trans (kwset.c:657)
by 0x4143CA: bmexec (kwset.c:678)
by 0x414973: kwsexec (kwset.c:848)
by 0x414DC4: Fexecute (kwsearch.c:128)
by 0x404E2E: grepbuf (grep.c:1238)
by 0x4054BF: grep (grep.c:1417)
by 0x405CEB: grepdesc (grep.c:1645)
by 0x405EC1: grep_command_line_arg (grep.c:1692)
by 0x4077D4: main (grep.c:2570)
See the accompanying test for how to trigger the heap buffer overrun.
Thanks to Nima Aghdaii for testing and finding numerous
ways to break early iterations of this patch.
---
NEWS | 5 +++++
THANKS.in | 1 +
src/kwset.c | 2 ++
tests/Makefile.am | 1 +
tests/kwset-abuse | 32 ++++++++++++++++++++++++++++++++
5 files changed, 41 insertions(+)
create mode 100755 tests/kwset-abuse
Index: grep-2.21/src/kwset.c
===================================================================
--- grep-2.21.orig/src/kwset.c
+++ grep-2.21/src/kwset.c
@@ -643,6 +643,8 @@ bmexec_trans (kwset_t kwset, char const
if (! tp)
return -1;
tp++;
+ if (ep <= tp)
+ break;
}
}
}
Index: grep-2.21/tests/Makefile.am
===================================================================
--- grep-2.21.orig/tests/Makefile.am
+++ grep-2.21/tests/Makefile.am
@@ -72,6 +72,7 @@ TESTS = \
inconsistent-range \
invalid-multibyte-infloop \
khadafy \
+ kwset-abuse \
long-line-vs-2GiB-read \
match-lines \
max-count-overread \
Index: grep-2.21/tests/Makefile.in
===================================================================
--- grep-2.21.orig/tests/Makefile.in
+++ grep-2.21/tests/Makefile.in
@@ -1376,6 +1376,7 @@ TESTS = \
inconsistent-range \
invalid-multibyte-infloop \
khadafy \
+ kwset-abuse \
long-line-vs-2GiB-read \
match-lines \
max-count-overread \
@@ -2030,6 +2031,13 @@ khadafy.log: khadafy
$(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)
+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'; \
Index: grep-2.21/tests/kwset-abuse
===================================================================
--- /dev/null
+++ grep-2.21/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 <http://www.gnu.org/licenses/>.
+
+. "${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

View File

@ -1,3 +1,12 @@
-------------------------------------------------------------------
Mon Nov 2 18:20:38 UTC 2015 - astieger@suse.com
- GNU grep 2.22:
* Improve performance for patterns containing very long strings
* Output and pattern matching bug fixes
- drop add gnulib-perl522.patch, changed upstream
- drop grep-F-heap-overrun.patch, included upstream
-------------------------------------------------------------------
Mon Jul 6 10:10:12 UTC 2015 - coolo@suse.com

View File

@ -17,7 +17,7 @@
Name: grep
Version: 2.21
Version: 2.22
Release: 0
Summary: Print lines matching a pattern
License: GPL-3.0+
@ -26,9 +26,6 @@ Url: http://www.gnu.org/software/grep/
Source0: http://ftp.gnu.org/gnu/%{name}/%{name}-%{version}.tar.xz
Source2: http://ftp.gnu.org/gnu/%{name}/%{name}-%{version}.tar.xz.sig
Source3: http://savannah.gnu.org/project/memberlist-gpgkeys.php?group=grep&download=1#/%{name}.keyring
Patch0: grep-F-heap-overrun.patch
# PATCH-FIX-UPSTREAM http://comments.gmane.org/gmane.comp.lib.gnulib.bugs/35272
Patch1: gnulib-perl522.patch
BuildRequires: makeinfo
BuildRequires: pcre-devel
BuildRequires: xz
@ -46,8 +43,6 @@ the matching lines.
%prep
%setup -q
%patch0 -p1
%patch1 -p1
chmod +x tests/kwset-abuse
%if 0%{?suse_version} < 1120
echo "ac_cv_search_pcre_compile=\${ac_cv_search_pcre_compile=%{_libdir}/libpcre.a}" >config.cache