summaryrefslogtreecommitdiffstats
path: root/abs/core-testing/grep/14-mem-exhausted.patch
blob: d6a996d0a0c3cb3df60330747003282665891676 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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.  */