- Fix 'memory exhausted' errors by limiting in-memory buffer (bug #198165).

- Resolves: rhbz#198165
This commit is contained in:
Tim Waugh 2006-11-22 14:55:12 +00:00
parent 9f6a55002d
commit 16976527ae
2 changed files with 21 additions and 1 deletions

15
grep-mem-exhausted.patch Normal file
View File

@ -0,0 +1,15 @@
--- grep-2.5.1a/src/grep.c.mem-exhausted 2006-11-22 14:49:35.000000000 +0000
+++ grep-2.5.1a/src/grep.c 2006-11-22 14:53:12.000000000 +0000
@@ -299,6 +299,12 @@
int cc = 1;
char *readbuf;
size_t readsize;
+ const size_t max_save = 200 * 1024 * 1024;
+
+ /* Limit the amount of saved data to 200Mb so we don't fail on
+ * large files. */
+ if (save > max_save)
+ save = max_save;
/* Offset from start of buffer to start of old stuff
that we want to save. */

View File

@ -1,7 +1,7 @@
Summary: The GNU versions of grep pattern matching utilities. Summary: The GNU versions of grep pattern matching utilities.
Name: grep Name: grep
Version: 2.5.1 Version: 2.5.1
Release: 54.1 Release: 55%{?dist}
License: GPL License: GPL
Group: Applications/Text Group: Applications/Text
Source: ftp://ftp.gnu.org/pub/gnu/grep/grep-%{version}a.tar.bz2 Source: ftp://ftp.gnu.org/pub/gnu/grep/grep-%{version}a.tar.bz2
@ -18,6 +18,7 @@ Patch11: grep-2.5.1-dfa-optional.patch
Patch12: grep-2.5.1-tests.patch Patch12: grep-2.5.1-tests.patch
Patch13: grep-2.5.1-w.patch Patch13: grep-2.5.1-w.patch
Patch14: grep-P.patch Patch14: grep-P.patch
Patch15: grep-mem-exhausted.patch
URL: http://www.gnu.org/software/grep/ URL: http://www.gnu.org/software/grep/
Prereq: /sbin/install-info Prereq: /sbin/install-info
Buildroot: %{_tmppath}/%{name}-%{version}-root Buildroot: %{_tmppath}/%{name}-%{version}-root
@ -47,6 +48,7 @@ utility for searching through text.
%patch12 -p1 -b .tests %patch12 -p1 -b .tests
%patch13 -p1 -b .w %patch13 -p1 -b .w
%patch14 -p1 -b .P %patch14 -p1 -b .P
%patch15 -p1 -b .mem-exhausted
chmod a+x tests/fmbtest.sh chmod a+x tests/fmbtest.sh
%build %build
@ -96,6 +98,9 @@ fi
%{_mandir}/*/* %{_mandir}/*/*
%changelog %changelog
* Wed Nov 22 2006 Tim Waugh <twaugh@redhat.com> 2.5.1-55
- Fix 'memory exhausted' errors by limiting in-memory buffer (bug #198165).
* Wed Jul 12 2006 Jesse Keating <jkeating@redhat.com> - 2.5.1-54.1 * Wed Jul 12 2006 Jesse Keating <jkeating@redhat.com> - 2.5.1-54.1
- rebuild - rebuild