From 16976527ae9146ef9d687e3d7ca7d6f0e27d0e12 Mon Sep 17 00:00:00 2001 From: Tim Waugh Date: Nov 22 2006 14:55:12 +0000 Subject: - Fix 'memory exhausted' errors by limiting in-memory buffer (bug #198165). - Resolves: rhbz#198165 --- diff --git a/grep-mem-exhausted.patch b/grep-mem-exhausted.patch new file mode 100644 index 0000000..d6a996d --- /dev/null +++ b/grep-mem-exhausted.patch @@ -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. */ diff --git a/grep.spec b/grep.spec index 6a28139..b59feb8 100644 --- a/grep.spec +++ b/grep.spec @@ -1,7 +1,7 @@ Summary: The GNU versions of grep pattern matching utilities. Name: grep Version: 2.5.1 -Release: 54.1 +Release: 55%{?dist} License: GPL Group: Applications/Text 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 Patch13: grep-2.5.1-w.patch Patch14: grep-P.patch +Patch15: grep-mem-exhausted.patch URL: http://www.gnu.org/software/grep/ Prereq: /sbin/install-info Buildroot: %{_tmppath}/%{name}-%{version}-root @@ -47,6 +48,7 @@ utility for searching through text. %patch12 -p1 -b .tests %patch13 -p1 -b .w %patch14 -p1 -b .P +%patch15 -p1 -b .mem-exhausted chmod a+x tests/fmbtest.sh %build @@ -96,6 +98,9 @@ fi %{_mandir}/*/* %changelog +* Wed Nov 22 2006 Tim Waugh 2.5.1-55 +- Fix 'memory exhausted' errors by limiting in-memory buffer (bug #198165). + * Wed Jul 12 2006 Jesse Keating - 2.5.1-54.1 - rebuild