summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'sys-apps/grep/files/grep-2.5.1-perl-segv.patch')
-rw-r--r--sys-apps/grep/files/grep-2.5.1-perl-segv.patch19
1 files changed, 19 insertions, 0 deletions
diff --git a/sys-apps/grep/files/grep-2.5.1-perl-segv.patch b/sys-apps/grep/files/grep-2.5.1-perl-segv.patch
new file mode 100644
index 000000000000..46218a1f4614
--- /dev/null
+++ b/sys-apps/grep/files/grep-2.5.1-perl-segv.patch
@@ -0,0 +1,19 @@
+Fix from upstream to fix a corner case segfault.
+
+http://bugs.gentoo.org/95495
+
+--- grep-2.5.1/src/search.c
++++ grep-2.5.1/src/search.c
+@@ -701,8 +701,10 @@
+ char eol = eolbyte;
+ if (!exact)
+ {
+- end = memchr (end, eol, buflim - end);
+- end++;
++ if (!(end = memchr (end, eol, buflim - end)))
++ end = buflim;
++ else
++ end++;
+ while (buf < beg && beg[-1] != eol)
+ --beg;
+ }